Web主机启动中未解决Singleton依赖关系

时间:2018-12-21 16:48:02

标签: c# asp.net-core-2.1

该解决方案最近从ASP.NET Core 2.0-> 2.1升级。运行新解决方案后,以下代码将产生以下错误:

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IApplicationLifetime appLifetime, TextingActivityListener textingActivityListener)

System.Exception
  HResult=0x80131500
  Message=Could not resolve a service of type 'CustomerExperience.Internal.Texting.TextingActivityListener' for the parameter 'textingActivityListener' of method 'Configure' on type 'CustomerExperience.Internal.Web.Startup'.
  Source=Microsoft.AspNetCore.Hosting
  StackTrace:
   at Microsoft.AspNetCore.Hosting.Internal.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.Internal.ConfigureBuilder.<>c__DisplayClass4_0.<Build>b__0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
   at Microsoft.AspNetCore.Hosting.Internal.AutoRequestServicesStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.<StartAsync>d__26.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.<RunAsync>d__5.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.<RunAsync>d__4.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
   at CustomerExperience.Internal.Web.Program.Main(String[] args) in C:\src\customer-experience\CustomerExperience.Internal.Web\Program.cs:line 18

Inner Exception 1:
MissingMethodException: Method not found: 'Void Newtonsoft.Json.JsonSerializer.set_TypeNameAssemblyFormat(System.Runtime.Serialization.Formatters.FormatterAssemblyStyle)'.

TextingActivityListener在同一解决方案的另一个项目中定义,该解决方案被编译为.NET Core 2.1类库。 具有Newtonsoft.Json依赖项。

0 个答案:

没有答案