解决:Volo.Abp.AbpInitializationException: An error occurred during ConfigureServices phase of the module Volo.Abp.Data.AbpDataModule, Volo.Abp.Data,

问题复现说明:

 

问题说明:

手动搭建AbpVnext框架,就搭了Web层,配置好WebModule和Program,运行就一直报:An error occurred during ConfigureServices phase of the module Volo.Abp.Data.AbpDataModule, Volo.Abp.Data

解决办法:

var builder = WebApplication.CreateBuilder(args);

builder.Services.ReplaceConfiguration(builder.Configuration);  // 替换下配置类
builder.Services.AddApplication<FGWebModule>();
var app = builder.Build();

 

如果你没有配置Autofac的话,此时会报另外一个错误:

InvalidOperationException: Unable to resolve service for type 'Volo.Abp.Http.Modeling.IApiDescriptionModelProvider' while attempting to activate 'Volo.Abp.Http.ProxyScripting.ProxyScriptManager'.

 

解决办法是:

var builder = WebApplication.CreateBuilder(args);

builder.Host.UseAutofac();  //使用Autofac
builder.Services.ReplaceConfiguration(builder.Configuration);
builder.Services.AddApplication<FGWebModule>();
var app = builder.Build();

 

posted @ 2023-06-22 09:30  湘龍  阅读(1174)  评论(0编辑  收藏  举报