No theme registered! Use AbpThemingOptions to register themes

发布于:2022-12-25 ⋅ 阅读:(386) ⋅ 点赞:(0)

An unhandled exception has occurred while executing the request.
Volo.Abp.AbpException: No theme registered! Use AbpThemingOptions to register themes.
   at Volo.Abp.AspNetCore.Mvc.UI.Theming.DefaultThemeSelector.GetCurrentThemeInfo()
   at Volo.Abp.AspNetCore.Mvc.UI.Theming.DefaultThemeManager.GetCurrentTheme()
   at Volo.Abp.AspNetCore.Mvc.UI.Theming.DefaultThemeManager.get_CurrentTheme()

解决方案:

        没有总结出来,估计是ABP的模块依赖没写对。

参考一下我的web项目,一体的,没有分层

Portal.Web.csproj

<PackageReference Include="Serilog.AspNetCore" Version="6.0.1" />
        <PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
        <PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="6.0.8" />
        <PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI" Version="5.3.4" />
        <PackageReference Include="Volo.Abp.Autofac" Version="5.3.4" />
        <PackageReference Include="Volo.Abp.AutoMapper" Version="5.3.4" />
        <PackageReference Include="Volo.Abp.BlobStoring.Minio" Version="5.3.4" />
        <PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" Version="5.3.4" />
        <PackageReference Include="Volo.Abp.AspNetCore.Authentication.OpenIdConnect" Version="5.3.4" />
        <PackageReference Include="Volo.Abp.Http.Client.Web" Version="5.3.4" />
        <PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="5.3.4" />
        <PackageReference Include="Volo.Abp.Swashbuckle" Version="5.3.4" />
        <PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="5.3.4" />
        <ProjectReference Include="..\Portal.Application\Portal.Application.csproj" />
        <ProjectReference Include="..\Portal.EntityFrameworkCore\Portal.EntityFrameworkCore.csproj" />
        <ProjectReference Include="..\Portal.HttpApi\Portal.HttpApi.csproj" />

PortalWebModule.cs文件,并不包括AbpThemingOptions的任何设置

[DependsOn(
    typeof(PortalApplicationModule),
    typeof(PortalEntityFrameworkCoreModule),
    typeof(AbpAutofacModule),
    typeof(AbpLocalizationModule),
    typeof(AbpAuthorizationModule),
    typeof(AbpAspNetCoreAuthenticationOpenIdConnectModule),
    //typeof(AbpAspNetCoreMvcUiModule),
    typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
    //typeof(AbpIdentityWebModule),
    typeof(AbpAspNetCoreSerilogModule),
    typeof(AbpSwashbuckleModule)
    )]
public class PortalWebModule : AbpModule

有的人说是这句影响的

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

本文含有隐藏内容,请 开通VIP 后查看