Activities of "mc86"

项目api 部署在https://master.aysdlrmyy.com:28445 认证 部署在https://master.aysdlrmyy.com:28443 本地blazor host启动路径是https://localhost:44333 查看了迁移记录 https://abp.io/docs/latest/release-info/migration-guides/abp-8-2-blazor-web-app

https://github.com/abpframework/abp/issues/22622

修改了RemoteServices.BaseUrl

"RemoteServices": { "Default": { "BaseUrl": "https://localhost:44333" },

现在无法wasm下找不到HTTP方法. Unhandled exception rendering component: Could not find remote action for method: System.Threading.Tasks.Task1[Volo.Abp.Application.Dtos.PagedResultDto1[Contract.Shared.LookupDto1[System.Guid]]] GetReviewKeyLookupAsync(Contract.Shared.LookupRequestDto) on the URL: https://localhost:44333 Volo.Abp.AbpException: Could not find remote action for method: System.Threading.Tasks.Task1[Volo.Abp.Application.Dtos.PagedResultDto1[Contract.Shared.LookupDto1[System.Guid]]] GetReviewKeyLookupAsync(Contract.Shared.LookupRequestDto) on the URL: https://localhost:44333 at Volo.Abp.Http.Client.DynamicProxying.ApiDescriptionFinder.FindActionAsync(:44333/HttpClient client, String baseUrl, Type serviceType, MethodInfo method) at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor1.<GetActionApiDescriptionModel>d__25[[Contract.ClassOnes.IClassOnesAppService, Contract.Application.Contracts, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext((索引)) at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor1.<InterceptAsync>d__24[[Contract.ClassOnes.IClassOnesAppService, Contract.Application.Contracts, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext((索引)) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.<InterceptAsync>d__31[[Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor1[[Contract.ClassOnes.IClassOnesAppService, Contract.Application.Contracts, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null]], Volo.Abp.Http.Client, Version=9.3.5.0, Culture=neutral, PublicKeyToken=null],[Volo.Abp.Application.Dtos.PagedResultDto1[[Contract.Shared.LookupDto1[[System.Guid, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], Contract.Application.Contracts, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null]], Volo.Abp.Ddd.Application.Contracts, Version=9.3.5.0, Culture=neutral, PublicKeyToken=null]].MoveNext((索引)) at Castle.DynamicProxy.AsyncInterceptorBase.<ProceedAsynchronous>d__141[[Volo.Abp.Application.Dtos.PagedResultDto1[[Contract.Shared.LookupDto1[[System.Guid, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], Contract.Application.Contracts, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null]], Volo.Abp.Ddd.Application.Contracts, Version=9.3.5.0, Culture=neutral, PublicKeyToken=null]].MoveNext((索引)) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.<ProceedAsync>d__7[[Volo.Abp.Application.Dtos.PagedResultDto1[[Contract.Shared.LookupDto1[[System.Guid, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], Contract.Application.Contracts, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null]], Volo.Abp.Ddd.Application.Contracts, Version=9.3.5.0, Culture=neutral, PublicKeyToken=null]].MoveNext((索引)) at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(:44333/IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.<InterceptAsync>d__31[[Volo.Abp.Validation.ValidationInterceptor, Volo.Abp.Validation, Version=9.3.5.0, Culture=neutral, PublicKeyToken=null],[Volo.Abp.Application.Dtos.PagedResultDto1[[Contract.Shared.LookupDto`1[[System.Guid, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], Contract.Application.Contracts, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null]], Volo.Abp.Ddd.Application.Contracts, Version=9.3.5.0, Culture=neutral, PublicKeyToken=null]].MoveNext((索引)) at :44333/Contract.Blazor.Pages.Contract.ClassOnes.GetReviewKeyLookupAsync(String newValue) in E:\Master9.0\modules\Contract\src\Contract.Blazor\Pages\Contract\ClassOnes.razor.cs:line 401 at :44333/Contract.Blazor.Pages.Contract.ClassOnes.OnInitializedAsync() in E:\Master9.0\modules\Contract\src\Contract.Blazor\Pages\Contract\ClassOnes.razor.cs:line 115 at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync((索引)) at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(:44333/Task taskToHandle, ComponentState owningComponentState)

{ "AuthServer": { "Authority": "https://master.aysdlrmyy.com:28443" }, "RemoteServices": { "Default": { "BaseUrl": "https://master.aysdlrmyy.com:28445" }, "AbpAccountPublic": { "BaseUrl": "https://master.aysdlrmyy.com:28443" } } }

api 部署在https://master.aysdlrmyy.com:28445 端口下. 目前浏览器中报这个错误:warn: Volo.Abp.IdentityModel.IdentityModelAuthenticationService[0] Could not find IdentityClientConfiguration for AbpMvcClient. Either define a configuration for AbpMvcClient or set a default configuration.

client

using System;
using System.Net.Http;
using Blazorise.Bootstrap5;
using Blazorise.Icons.FontAwesome;
using Microsoft.AspNetCore.Components.WebAssembly.Authentication;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Master9.Blazor.Client.Navigation;
using OpenIddict.Abstractions;
using Volo.Abp.AspNetCore.Components.Web;
using Volo.Abp.AspNetCore.Components.Web.Theming.Routing;
using Volo.Abp.Autofac.WebAssembly;
using Volo.Abp.AutoMapper;
using Volo.Abp.Modularity;
using Volo.Abp.UI.Navigation;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling;
using Master9.Blazor.Client.Components.Layout;
using Volo.Abp.AspNetCore.Components.WebAssembly.LeptonXTheme;
using Volo.Abp.AspNetCore.Components.Web.LeptonXTheme;
using Volo.Abp.LeptonX.Shared;
using Volo.Abp.SettingManagement.Blazor.WebAssembly;
using Volo.Abp.FeatureManagement.Blazor.WebAssembly;
using Volo.Abp.Account.Pro.Admin.Blazor.WebAssembly;
using Volo.Abp.Account.Pro.Public.Blazor.WebAssembly;
using Volo.Abp.Identity.Pro.Blazor.Server.WebAssembly;
using Volo.Abp.AuditLogging.Blazor.WebAssembly;
using Volo.Abp.Gdpr.Blazor.Extensions;
using Volo.Abp.Gdpr.Blazor.WebAssembly;
using Volo.Abp.LanguageManagement.Blazor.WebAssembly;
using Volo.Abp.OpenIddict.Pro.Blazor.WebAssembly;
using Volo.Abp.TextTemplateManagement.Blazor.WebAssembly;
using Volo.Saas.Host.Blazor.WebAssembly;
using FollowUp.Blazor.WebAssembly;
using Contract.Blazor.WebAssembly;

using DevExpress.Blazor;
using DevExpress.Blazor.Localization;
using Master9.Blazor.Client.Resources;
using System.Globalization;



namespace Master9.Blazor.Client;

[DependsOn(
    typeof(AbpSettingManagementBlazorWebAssemblyModule),
    typeof(AbpFeatureManagementBlazorWebAssemblyModule),
   
    typeof(AbpAccountAdminBlazorWebAssemblyModule),
    typeof(AbpAccountPublicBlazorWebAssemblyModule),
    typeof(AbpIdentityProBlazorWebAssemblyModule),
    typeof(SaasHostBlazorWebAssemblyModule),
    typeof(AbpOpenIddictProBlazorWebAssemblyModule),
    typeof(AbpAuditLoggingBlazorWebAssemblyModule),
    typeof(AbpGdprBlazorWebAssemblyModule),
    typeof(TextTemplateManagementBlazorWebAssemblyModule),
    typeof(LanguageManagementBlazorWebAssemblyModule),
  
    typeof(AbpAspNetCoreComponentsWebAssemblyLeptonXThemeModule),
    typeof(AbpAutofacWebAssemblyModule),
    typeof(Master9HttpApiClientModule)
)]
[DependsOn(typeof(FollowUpBlazorWebAssemblyModule))]
[DependsOn(typeof(ContractBlazorWebAssemblyModule))]
    public class Master9BlazorClientModule : AbpModule
{
    public override void PreConfigureServices(ServiceConfigurationContext context)
    {
        PreConfigure<AbpAspNetCoreComponentsWebOptions>(options =>
        {
            options.IsBlazorWebApp = true;
        }); 
    }
    
    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        var environment = context.Services.GetSingletonInstance<IWebAssemblyHostEnvironment>();
        var builder = context.Services.GetSingletonInstance<WebAssemblyHostBuilder>();
        context.Services.AddDevExpressBlazor(configure => configure.BootstrapVersion = BootstrapVersion.v5);
        ConfigureDevExpressL18n(builder);
        ConfigureAuthentication(builder);
        ConfigureHttpClient(context, environment);
        ConfigureBlazorise(context);
        ConfigureRouter(context);
        ConfigureMenu(context);
        ConfigureAutoMapper(context);
        ConfigureCookieConsent(context);
        ConfigureTheme();
    }
    
    private void ConfigureCookieConsent(ServiceConfigurationContext context)
    {
        context.Services.AddAbpCookieConsent(options =>
        {
            options.IsEnabled = true;
            options.CookiePolicyUrl = "/CookiePolicy";
            options.PrivacyPolicyUrl = "/PrivacyPolicy";
        });
    }

    private void ConfigureTheme()
    {
        Configure<LeptonXThemeOptions>(options =>
        {
            options.DefaultStyle = LeptonXStyleNames.System;
        });

        Configure<LeptonXThemeBlazorOptions>(options =>
        {
            // When Layout is changed, the `options.Parameters["LeptonXTheme.Layout"]` in Master9BlazorModule.cs should be updated accordingly.
            options.Layout = LeptonXBlazorLayouts.SideMenu;
        });
    }

    private void ConfigureRouter(ServiceConfigurationContext context)
    {
        Configure<AbpRouterOptions>(options =>
        {
            options.AppAssembly = typeof(Master9BlazorClientModule).Assembly;
        });
    }

    private void ConfigureMenu(ServiceConfigurationContext context)
    {
        Configure<AbpNavigationOptions>(options =>
        {
            options.MenuContributors.Add(new Master9MenuContributor(context.Services.GetConfiguration()));
        });
    }

    private void ConfigureBlazorise(ServiceConfigurationContext context)
    {
        context.Services
            .AddBootstrap5Providers()
            .AddFontAwesomeIcons();
    }

    private static void ConfigureAuthentication(WebAssemblyHostBuilder builder)
    {
        builder.Services.AddBlazorWebAppServices();
        //builder.Services.AddBlazorWebAppTieredServices();
    }
    
    private static void ConfigureHttpClient(ServiceConfigurationContext context, IWebAssemblyHostEnvironment environment)
    {
        
        context.Services.AddTransient(sp => new HttpClient()
        {
            BaseAddress = new Uri(environment.BaseAddress),
            
        });
    }

    private void ConfigureAutoMapper(ServiceConfigurationContext context)
    {
        Configure<AbpAutoMapperOptions>(options =>
        {
            options.AddMaps<Master9BlazorClientModule>();
        });
    }
    private static void ConfigureDevExpressL18n(WebAssemblyHostBuilder builder)
    {
        builder.Services.AddLocalization();
        //builder.Services.AddLocalization();
        builder.Services.AddSingleton(typeof(IDxLocalizationService), typeof(LocalizationService));
        var culture = new CultureInfo("zh-Hans");
        CultureInfo.DefaultThreadCurrentCulture = culture;
        CultureInfo.DefaultThreadCurrentUICulture = culture;
    }
}

private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration) {

    //Configure&lt;AbpAntiForgeryOptions&gt;(options =>
    //{
    //    options.TokenCookie.Expiration = TimeSpan.FromDays(365);
    //    options.TokenCookie.SameSite = SameSiteMode.None;
    //    options.TokenCookie.SecurePolicy = CookieSecurePolicy.Always;
      
    //});

    context.Services.AddAuthentication(options =>
        {
            options.DefaultScheme = "Cookies";
            options.DefaultChallengeScheme = "oidc";
             
        })
        .AddCookie("Cookies", options =>
        {
            options.ExpireTimeSpan = TimeSpan.FromDays(365);
          
            options.IntrospectAccessToken();
        })
        .AddAbpOpenIdConnect("oidc", options =>
        {
            options.Authority = configuration["AuthServer:Authority"];
            options.RequireHttpsMetadata = configuration.GetValue&lt;bool&gt;("AuthServer:RequireHttpsMetadata");;
            options.ResponseType = OpenIdConnectResponseType.CodeIdToken;

            options.ClientId = configuration["AuthServer:ClientId"];
            options.ClientSecret = configuration["AuthServer:ClientSecret"];
            
            options.SaveTokens = true;
            options.GetClaimsFromUserInfoEndpoint = true;

            options.Scope.Add("roles");
            options.Scope.Add("email");
            options.Scope.Add("phone");
            options.Scope.Add("Master9");
        });

        if (configuration.GetValue&lt;bool&gt;("AuthServer:IsOnK8s"))
        {
            context.Services.Configure&lt;OpenIdConnectOptions&gt;("oidc", options =>
            {
                options.TokenValidationParameters.ValidIssuers = new[]
                {
                    configuration["AuthServer:MetaAddress"]!.EnsureEndsWith('/'),
                    configuration["AuthServer:Authority"]!.EnsureEndsWith('/')
                };

                options.MetadataAddress = configuration["AuthServer:MetaAddress"]!.EnsureEndsWith('/') +
                                        ".well-known/openid-configuration";

                var previousOnRedirectToIdentityProvider = options.Events.OnRedirectToIdentityProvider;
                options.Events.OnRedirectToIdentityProvider = async ctx =>
                {
                    // Intercept the redirection so the browser navigates to the right URL in your host
                    ctx.ProtocolMessage.IssuerAddress = configuration["AuthServer:Authority"]!.EnsureEndsWith('/') + "connect/authorize";

                    if (previousOnRedirectToIdentityProvider != null)
                    {
                        await previousOnRedirectToIdentityProvider(ctx);
                    }
                };
                var previousOnRedirectToIdentityProviderForSignOut = options.Events.OnRedirectToIdentityProviderForSignOut;
                options.Events.OnRedirectToIdentityProviderForSignOut = async ctx =>
                {
                    // Intercept the redirection for signout so the browser navigates to the right URL in your host
                    ctx.ProtocolMessage.IssuerAddress = configuration["AuthServer:Authority"]!.EnsureEndsWith('/') + "connect/endsession";

                    if (previousOnRedirectToIdentityProviderForSignOut != null)
                    {
                        await previousOnRedirectToIdentityProviderForSignOut(ctx);
                    }
                };
            });

        }

    context.Services.Configure&lt;AbpClaimsPrincipalFactoryOptions&gt;(options =>
    {
        options.IsDynamicClaimsEnabled = true;
    });
}

private void ConfigureImpersonation(ServiceConfigurationContext context, IConfiguration configuration)
{
    context.Services.Configure&lt;SaasHostBlazorOptions&gt;(options =>
    {
        options.EnableTenantImpersonation = true;
    });
    context.Services.Configure&lt;AbpIdentityProBlazorOptions&gt;(options =>
    {
        options.EnableUserImpersonation = true;
    });
}

private void ConfigureVirtualFileSystem(IWebHostEnvironment hostingEnvironment)
{
    if (hostingEnvironment.IsDevelopment())
    {
        Configure&lt;AbpVirtualFileSystemOptions&gt;(options =>
        {
            options.FileSets.ReplaceEmbeddedByPhysical&lt;Master9DomainSharedModule&gt;(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}Master9.Domain.Shared"));
            options.FileSets.ReplaceEmbeddedByPhysical&lt;Master9ApplicationContractsModule&gt;(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}Master9.Application.Contracts"));
            options.FileSets.ReplaceEmbeddedByPhysical&lt;Master9BlazorModule&gt;(hostingEnvironment.ContentRootPath);
        });
    }
}

private void ConfigureSwaggerServices(IServiceCollection services)
{
    services.AddAbpSwaggerGen(
        options =>
        {
            options.SwaggerDoc("v1", new OpenApiInfo { Title = "Master9 API", Version = "v1" });
            options.DocInclusionPredicate((docName, description) => true);
            options.CustomSchemaIds(type => type.FullName);
        }
    );
}

private void ConfigureCache(IConfiguration configuration)
{
    Configure&lt;AbpDistributedCacheOptions&gt;(options =>
    {
        options.KeyPrefix = "Master9:";
    });
}

private void ConfigureDataProtection(
    ServiceConfigurationContext context,
    IConfiguration configuration,
    IWebHostEnvironment hostingEnvironment)
{
    var dataProtectionBuilder = context.Services.AddDataProtection().SetApplicationName("Master9");
    if (!hostingEnvironment.IsDevelopment())
    {
        var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]!);
        dataProtectionBuilder.PersistKeysToStackExchangeRedis(redis, "Master9-Protection-Keys");
    }
}

private void ConfigureDistributedLocking(
    ServiceConfigurationContext context,
    IConfiguration configuration)
{
    context.Services.AddSingleton&lt;IDistributedLockProvider&gt;(sp =>
    {
        var connection = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]!);
        return new RedisDistributedSynchronizationProvider(connection.GetDatabase());
    });
}

private void ConfigureBlazorise(ServiceConfigurationContext context)
{
    context.Services
        .AddBootstrap5Providers()
        .AddFontAwesomeIcons();
}

private void ConfigureMenu(IConfiguration configuration)
{
    Configure&lt;AbpNavigationOptions&gt;(options =>
    {
        options.MenuContributors.Add(new Master9MenuContributor(configuration));
    });
}

private void ConfigureRouter()
{
    Configure&lt;AbpRouterOptions&gt;(options =>
    {
        options.AppAssembly = typeof(Master9BlazorModule).Assembly;
        options.AdditionalAssemblies.Add(typeof(Master9BlazorClientModule).Assembly);
    });
}

private void ConfigureAutoMapper()
{
    Configure&lt;AbpAutoMapperOptions&gt;(options =>
    {
        options.AddMaps&lt;Master9BlazorModule&gt;();
    });
}

public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
    var env = context.GetEnvironment();
    var app = context.GetApplicationBuilder();

    app.Use(async (ctx, next) =>
    {
        /* Converting to https to be able to include https URLs in `/.well-known/openid-configuration` endpoint.
         * This should only be done if the request is coming outside of the cluster.  */
        if (ctx.Request.Headers.ContainsKey("from-ingress"))
        {
            ctx.Request.Scheme = "https";
        }

        await next();
    });     
    
    if (env.IsDevelopment())
    {
        app.UseDeveloperExceptionPage();
    }

    app.UseAbpRequestLocalization();

    if (!env.IsDevelopment())
    {
        app.UseErrorPage();
        app.UseHsts();
    }

    app.UseCorrelationId();
    app.UseRouting();
    var configuration = context.GetConfiguration();
    if (Convert.ToBoolean(configuration["AuthServer:IsOnK8s"]))
    {
        app.Use(async (context, next) =>
        {
            if (context.Request.Path.Value != null &&
                context.Request.Path.Value.StartsWith("/appsettings", StringComparison.OrdinalIgnoreCase) &&
                context.Request.Path.Value.EndsWith(".json", StringComparison.OrdinalIgnoreCase))
            {
                // Set endpoint to null so the static files middleware will handle the request.
                context.SetEndpoint(null);
            }
            await next(context);
        });

        app.UseStaticFilesForPatterns("appsettings*.json");       
    }
    
       
    
	app.MapAbpStaticAssets(); 
    app.UseAbpSecurityHeaders();
    app.UseAuthentication();

    if (MultiTenancyConsts.IsEnabled)
    {
        app.UseMultiTenancy();
    }

    app.UseDynamicClaims();
    app.UseAntiforgery();
    app.UseAuthorization();
    app.UseSwagger();
    app.UseAbpSwaggerUI(options =>
    {
        options.SwaggerEndpoint("/swagger/v1/swagger.json", "Master9 API");
    });
    app.UseAbpSerilogEnrichers();
    app.UseConfiguredEndpoints(builder =>
    {
        builder.MapRazorComponents&lt;App&gt;()
            .AddInteractiveServerRenderMode()
            .AddInteractiveWebAssemblyRenderMode()
            .AddAdditionalAssemblies(builder.ServiceProvider.GetRequiredService&lt;IOptions&lt;AbpRouterOptions&gt;>().Value.AdditionalAssemblies.ToArray());
   
    });
}

InteractiveServer 模式正常.

blazor

using System;
using System.IO;
using Blazorise.Bootstrap5;
using Blazorise.Icons.FontAwesome;
using Medallion.Threading;
using Medallion.Threading.Redis;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.AspNetCore.Http;
using Master9.Localization;
using Master9.MultiTenancy;
using Volo.Abp;
using Volo.Abp.AspNetCore.Components.Web.Theming.Routing;
using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
using Volo.Abp.AspNetCore.Serilog;
using Volo.Abp.Autofac;
using Volo.Abp.AutoMapper;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.Swashbuckle;
using Volo.Abp.UI.Navigation;
using Volo.Abp.UI.Navigation.Urls;
using Volo.Abp.VirtualFileSystem;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.Extensions.Options;
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
using Microsoft.OpenApi.Models;
using Master9.Blazor.Client;
using Master9.Blazor.Client.Navigation;
using Master9.Blazor.Components;
using StackExchange.Redis;
using Volo.Abp.AspNetCore.Authentication.OpenIdConnect;
using Volo.Abp.AspNetCore.Components.Web;
using Volo.Abp.AspNetCore.Mvc.Client;
using Volo.Abp.Caching;
using Volo.Abp.Caching.StackExchangeRedis;
using Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling;
using Volo.Abp.AspNetCore.Components.Web.LeptonXTheme;
using Volo.Abp.AspNetCore.Components.Server.LeptonXTheme;
using Volo.Abp.AspNetCore.Components.Server.LeptonXTheme.Bundling;
using Volo.Abp.AspNetCore.Components.WebAssembly.LeptonXTheme.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonX;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonX.Bundling;
using Volo.Abp.LeptonX.Shared;
using Volo.Abp.DistributedLocking;
using Volo.Abp.Http.Client.Web;
using Volo.Abp.Http.Client.IdentityModel.Web;
using Volo.Abp.Security.Claims;
using Volo.Abp.Account.LinkUsers;
using Volo.Abp.Account.Pro.Admin.Blazor.Server;
using Volo.Abp.Account.Pro.Public.Blazor.Server;
using Volo.Abp.Account.Public.Web.Impersonation;
using Volo.Abp.Account.Pro.Public.Blazor.WebAssembly.Bundling;
using Volo.Abp.Identity.Pro.Blazor;
using Volo.Abp.Identity.Pro.Blazor.Server;
using Volo.Abp.AuditLogging.Blazor.Server;
using Volo.Abp.AuditLogging.Blazor.WebAssembly.Bundling;
using Volo.Abp.Gdpr.Blazor.Extensions;
using Volo.Abp.Gdpr.Blazor.Server;
using Volo.Abp.LanguageManagement.Blazor.Server;
using Volo.Abp.OpenIddict.Pro.Blazor.Server;
using Volo.Abp.TextTemplateManagement.Blazor.Server;
using Volo.Saas.Host;
using Volo.Saas.Host.Blazor;
using Volo.Saas.Host.Blazor.Server;
using Volo.Saas.Host.Blazor.WebAssembly.Bundling;
 

using FollowUp.Blazor.Server;
using Contract.Blazor.Server;
using System.Net.Http;
using DevExpress.Blazor;
using Volo.Abp.AspNetCore.Mvc.AntiForgery;
using Volo.Abp.FeatureManagement;

namespace Master9.Blazor;

[DependsOn(
    typeof(AbpCachingStackExchangeRedisModule),
    
    typeof(AbpDistributedLockingModule),
    typeof(AbpAutofacModule),
	typeof(AbpAccountPublicBlazorWebAssemblyBundlingModule),
	typeof(AbpAccountPublicWebImpersonationModule),
    typeof(AbpAccountAdminBlazorServerModule),
    typeof(AbpAccountPublicBlazorServerModule),
    typeof(AbpIdentityProBlazorServerModule),
    typeof(TextTemplateManagementBlazorServerModule),
    typeof(AbpAuditLoggingBlazorServerModule),
    typeof(AbpAuditLoggingBlazorWebAssemblyBundlingModule),
    typeof(AbpGdprBlazorServerModule),
    typeof(AbpOpenIddictProBlazorServerModule),
    typeof(LanguageManagementBlazorServerModule),
    typeof(SaasHostBlazorServerModule),
	typeof(SaasHostBlazorWebAssemblyBundlingModule),
    //typeof(LeptonXThemeManagementBlazorServerModule),
    typeof(AbpAspNetCoreComponentsServerLeptonXThemeModule),
    typeof(AbpAspNetCoreComponentsWebAssemblyLeptonXThemeBundlingModule),
    typeof(AbpAspNetCoreMvcUiLeptonXThemeModule),   
    typeof(AbpFeatureManagementHttpApiModule),
    typeof(AbpSwashbuckleModule),
    typeof(AbpAspNetCoreSerilogModule),
    typeof(AbpAspNetCoreMvcClientModule),
    typeof(AbpAspNetCoreAuthenticationOpenIdConnectModule),
    typeof(AbpHttpClientWebModule),
    typeof(AbpHttpClientIdentityModelWebModule),
    typeof(Master9HttpApiClientModule)
    )]
[DependsOn(typeof(FollowUpBlazorServerModule))]
[DependsOn(typeof(ContractBlazorServerModule))]

public class Master9BlazorModule : AbpModule
{
    public override void PreConfigureServices(ServiceConfigurationContext context)
    {
        context.Services.PreConfigure<AbpMvcDataAnnotationsLocalizationOptions>(options =>
        {
            options.AddAssemblyResource(
                typeof(Master9Resource),
                typeof(Master9DomainSharedModule).Assembly,
                typeof(Master9ApplicationContractsModule).Assembly,
                typeof(Master9BlazorModule).Assembly
            );
        });

        PreConfigure<AbpAspNetCoreComponentsWebOptions>(options =>
        {
            options.IsBlazorWebApp = true;
        });
    }

    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        var hostingEnvironment = context.Services.GetHostingEnvironment();
        var configuration = context.Services.GetConfiguration();

        if (!configuration.GetValue<bool>("App:DisablePII"))
        {
            Microsoft.IdentityModel.Logging.IdentityModelEventSource.ShowPII = true;
            Microsoft.IdentityModel.Logging.IdentityModelEventSource.LogCompleteSecurityArtifact = true;
        }

        // Add services to the container.
        context.Services.AddRazorComponents()
            .AddInteractiveServerComponents()
            .AddInteractiveWebAssemblyComponents();
        context.Services.AddDevExpressBlazor(configure => configure.BootstrapVersion = BootstrapVersion.v5);
        ConfigureUrls(configuration);
        ConfigureBundles();
        ConfigureAuthentication(context, configuration);
        ConfigureImpersonation(context, configuration);
        ConfigureAutoMapper();
        ConfigureVirtualFileSystem(hostingEnvironment);
        ConfigureSwaggerServices(context.Services);
        ConfigureCache(configuration);
        ConfigureDataProtection(context, configuration, hostingEnvironment);
        ConfigureDistributedLocking(context, configuration);
        ConfigureBlazorise(context);
        ConfigureRouter();
        ConfigureMenu(configuration);
        ConfigureCookieConsent(context);
        ConfigureTheme();
    }

    private void ConfigureCookieConsent(ServiceConfigurationContext context)
    {
        context.Services.AddAbpCookieConsent(options =>
        {
            options.IsEnabled = true;
            options.CookiePolicyUrl = "/CookiePolicy";
            options.PrivacyPolicyUrl = "/PrivacyPolicy";
        });
    }
    
    private void ConfigureTheme()
    {
        Configure<LeptonXThemeOptions>(options =>
        {
            options.DefaultStyle = LeptonXStyleNames.System;
        });

        Configure<LeptonXThemeBlazorOptions>(options =>
        {
            options.Layout = LeptonXBlazorLayouts.SideMenu;
        });
    }

    private void ConfigureUrls(IConfiguration configuration)
    {
        Configure<AppUrlOptions>(options =>
        {
            options.Applications["MVC"].RootUrl = configuration["App:SelfUrl"];
        });

        Configure<AbpAccountLinkUserOptions>(options =>
        {
            options.LoginUrl = configuration["AuthServer:Authority"];
        });
    }

    private void ConfigureBundles()
    {
        Configure<AbpBundlingOptions>(options =>
        {
            // Blazor Web App
            options.Parameters.InteractiveAuto = true;

            // MVC UI
            options.StyleBundles.Configure(
                LeptonXThemeBundles.Styles.Global,
                bundle =>
                {
                    bundle.AddFiles("/global-styles.css");
                }
            );

            options.ScriptBundles.Configure(
                LeptonXThemeBundles.Scripts.Global,
                bundle =>
                {
                    bundle.AddFiles("/global-scripts.js");
                }
            );

            // Blazor UI
            options.StyleBundles.Configure(
                BlazorLeptonXThemeBundles.Styles.Global,
                bundle =>
                {
                	bundle.AddFiles("/global-styles.css");
                    //bundle.AddFiles("/blazor-global-styles.css");
                    //You can remove the following line if you don't use Blazor CSS isolation for components
                    //bundle.AddFiles(new BundleFile("/Master9.Blazor.styles.css", true));
                    //bundle.AddFiles(new BundleFile("/Master9.Blazor.Client.styles.css", true));
                }
            );
        });

        Configure<AbpBundlingOptions>(options =>
        {
            var globalStyles = options.StyleBundles.Get(BlazorWebAssemblyStandardBundles.Styles.Global);
            globalStyles.AddContributors(typeof(Master9StyleBundleContributor));

            var globalScripts = options.ScriptBundles.Get(BlazorWebAssemblyStandardBundles.Scripts.Global);
            globalScripts.AddContributors(typeof(Master9ScriptBundleContributor));

            options.Parameters["LeptonXTheme.Layout"] = "side-menu"; // side-menu or top-menu
        });
    }

   
}

    

已发送

已发送.目前主要是登陆后状态丢失

好的.稍等建个测试项目

已共享

从代码上看直接重定向到了首页,触发登陆.没有相关请求登出操作,不清楚为什么 已发送代码到邮箱

Showing 11 to 20 of 100 entries
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.1.0-preview. Updated on December 12, 2025, 10:36
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.