Search code examples
asp.net-mvcintegrationlog4netaspnetboilerplatecastle

Could not convert string 'Log4netFactory' to a type


I recently updated ABP packages in my project with this line of code in NuGet console:

ForEach($project in get-project -all) {
 ForEach($package in Get-Package -ProjectName $project.ProjectName | ?{ $_.Id -like 'Abp*'}) {
  Update-Package -ProjectName $project.ProjectName -Id $package.Id;} }

But when I start the project, I faced this error:

An exception of type 'Castle.MicroKernel.SubSystems.Conversion.ConverterException' occurred in Castle.Windsor.dll but was not handled in user code Additional information: Could not convert string 'Castle.Services.Logging.Log4netIntegration.Log4netFactory,Castle.Services.Logging.Log4netIntegration,Version=4.0.0.0, Culture=neutral,PublicKeyToken=407dd0808d44fbdc' to a type.

That occurs in this line of code in Application_Start:

AbpBootstrapper.IocManager.IocContainer.AddFacility<LoggingFacility>(
    f => f.UseLog4Net().WithConfig("log4net.config")
);

How can I fix this problem?


Solution

  • you can use Abp.Castle.Log4Net Package. see document