部署到Ubuntu 18.04的ASP.NET Core 3.0应用抛出异常无法加载文件或程序集System.Diagnostics.TraceSource

时间:2019-11-26 00:04:19

标签: c# asp.net-core ubuntu-18.04 asp.net-core-3.0

无需赘言,该应用程序可在本地运行,但仅在部署到Ubuntu 18.04时才会引发此错误。

该应用程序没什么特别的,它使用Microsoft.Azure.Cosmos.Table和App Insights。更重要的是,它在.Net Core 2.2上运行了大约2周,但是Linux机器已经设置了自动更新。有一天,它只是停止工作而抛出此错误:

  

无法加载文件或程序集'System.Diagnostics.TraceSource,版本= 0.0.0.0,区域性=中性,PublicKeyToken = b03f5f7f11d50a3a'。系统找不到指定的文件。

因此,我决定使用ASP.NET Core 3.0,希望它可以解决此异常。但是不,整个程序包都会更改,错误仍然存​​在!

我尝试了独立的,可移植的linux-x64 ...不走运:|

我不知道这个包裹是从哪里来的。堆栈跟踪显示这来自Microsoft.WindowsAzure.Storage。但是我不会在测试项目的项目 中使用它!

堆栈跟踪:

  

Microsoft.WindowsAzure.Storage.StorageException:      在Microsoft.WindowsAzure.Storage.Core.Executor.Executor + d__4 1.MoveNext (Microsoft.WindowsAzure.Storage, Version=9.3.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at ShortenerServices.UriStorage+<GetFullUriByShortenedPartAsync>d__1.MoveNext (ShortenerServices, Version=1.0.0.0, Culture=neutral, PublicKeyToken=nullShortenerServices, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: E:\repos\URLShortener\ShortenerServices\UriStorage.csShortenerServices, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: 36) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at ShortenerServices.ShortenerService+<GetSourceUriByShortenedPartAsync>d__3.MoveNext (ShortenerServices, Version=1.0.0.0, Culture=neutral, PublicKeyToken=nullShortenerServices, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: E:\repos\URLShortener\ShortenerServices\ShortenerService.csShortenerServices, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: 40) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at URLShortener.Pages.IndexModel+<OnGetAsync>d__1.MoveNext (URLShortener, Version=1.0.0.0, Culture=neutral, PublicKeyToken=nullURLShortener, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: E:\repos\URLShortener\URLShortener\Pages\Index.cshtml.csURLShortener, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: 30) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter 1.GetResult(System.Private.CoreLib,版本= 4.0.0.0,文化=中性,PublicKeyToken = 7cec85d7bea7798e)      在Microsoft.AspNetCore.Mvc.RazorPages.Internal.ExecutorFactory + GenericTaskHandlerMethod + d__4 1.MoveNext (Microsoft.AspNetCore.Mvc.RazorPages, Version=2.2.5.0, Culture=neutral, PublicKeyToken=adb9793829ddae60) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter 1.GetResult(System.Private.CoreLib,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = 7cec85d7bea7798e)中      在Microsoft.AspNetCore.Mvc.RazorPages.Internal.ExecutorFactory + GenericTaskHandlerMethod + d__3.MoveNext(Microsoft.AspNetCore.Mvc.RazorPages,Version = 2.2.5.0,Culture = neutral,PublicKeyToken = adb9793829ddae60)中      在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw(System.Private.CoreLib,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = 7cec85d7bea7798e)      在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Private.CoreLib,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = 7cec85d7bea7798e)中      在System.Runtime.CompilerServices.TaskAwaiter 1.GetResult (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at Microsoft.AspNetCore.Mvc.RazorPages.Internal.PageActionInvoker+<InvokeHandlerMethodAsync>d__30.MoveNext (Microsoft.AspNetCore.Mvc.RazorPages, Version=2.2.5.0, Culture=neutral, PublicKeyToken=adb9793829ddae60) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at Microsoft.AspNetCore.Mvc.RazorPages.Internal.PageActionInvoker+<InvokeNextPageFilterAsync>d__32.MoveNext (Microsoft.AspNetCore.Mvc.RazorPages, Version=2.2.5.0, Culture=neutral, PublicKeyToken=adb9793829ddae60) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at Microsoft.AspNetCore.Mvc.RazorPages.Internal.PageActionInvoker.Rethrow (Microsoft.AspNetCore.Mvc.RazorPages, Version=2.2.5.0, Culture=neutral, PublicKeyToken=adb9793829ddae60) at Microsoft.AspNetCore.Mvc.RazorPages.Internal.PageActionInvoker.Next (Microsoft.AspNetCore.Mvc.RazorPages, Version=2.2.5.0, Culture=neutral, PublicKeyToken=adb9793829ddae60) at Microsoft.AspNetCore.Mvc.RazorPages.Internal.PageActionInvoker+<InvokeInnerFilterAsync>d__22.MoveNext (Microsoft.AspNetCore.Mvc.RazorPages, Version=2.2.5.0, Culture=neutral, PublicKeyToken=adb9793829ddae60) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker+<InvokeNextResourceFilter>d__23.MoveNext (Microsoft.AspNetCore.Mvc.Core, Version=2.2.5.0, Culture=neutral, PublicKeyToken=adb9793829ddae60) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow (Microsoft.AspNetCore.Mvc.Core, Version=2.2.5.0, Culture=neutral, PublicKeyToken=adb9793829ddae60) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next (Microsoft.AspNetCore.Mvc.Core, Version=2.2.5.0, Culture=neutral, PublicKeyToken=adb9793829ddae60) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker+<InvokeFilterPipelineAsync>d__18.MoveNext (Microsoft.AspNetCore.Mvc.Core, Version=2.2.5.0, Culture=neutral, PublicKeyToken=adb9793829ddae60) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker+<InvokeAsync>d__16.MoveNext (Microsoft.AspNetCore.Mvc.Core, Version=2.2.5.0, Culture=neutral, PublicKeyToken=adb9793829ddae60) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at Microsoft.AspNetCore.Routing.EndpointMiddleware+<Invoke>d__3.MoveNext (Microsoft.AspNetCore.Routing, Version=2.2.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware+<Invoke>d__6.MoveNext (Microsoft.AspNetCore.Routing, Version=2.2.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware+<Invoke>d__7.MoveNext (Microsoft.AspNetCore.StaticFiles, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware+<Invoke>d__6.MoveNext (Microsoft.AspNetCore.Diagnostics, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60) Inner exception System.IO.FileNotFoundException handled at Microsoft.WindowsAzure.Storage.Core.Executor.Executor+<ExecuteAsyncInternal>d__4 1.MoveNext:      在Newtonsoft.Json.JsonSerializer.DeserializeInternal(Newtonsoft.Json,版本= 11.0.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed)      在Newtonsoft.Json.Linq.JToken.ToObject(Newtonsoft.Json,Version = 11.0.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed)处      在Newtonsoft.Json.Linq.JToken.ToObject(Newtonsoft.Json,Version = 11.0.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed)处      在Microsoft.WindowsAzure.Storage.Table.Protocol.TableOperationHttpResponseParsers.ReadSingleItem(Microsoft.WindowsAzure.Storage,Version = 9.3.2.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35)      在Microsoft.WindowsAzure.Storage.Table.Protocol.TableOperationHttpResponseParsers + d__5.MoveNext(Microsoft.WindowsAzure.Storage,版本= 9.3.2.0,文化=中性,PublicKeyToken = 31bf3856ad364e35)      在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw(System.Private.CoreLib,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = 7cec85d7bea7798e)      在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Private.CoreLib,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = 7cec85d7bea7798e)中      在Microsoft.WindowsAzure.Storage.Table.Protocol.TableOperationHttpResponseParsers + d__3 1.MoveNext (Microsoft.WindowsAzure.Storage, Version=9.3.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at Microsoft.WindowsAzure.Storage.Table.TableQuery 1 + <> c__DisplayClass24_0 2+<<QueryImpl>b__2>d.MoveNext (Microsoft.WindowsAzure.Storage, Version=9.3.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at Microsoft.WindowsAzure.Storage.Core.Executor.Executor+<ExecuteAsyncInternal>d__4 1.MoveNext(Microsoft.WindowsAzure.Storage,Version = 9.3.2.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35)

更新-部署到App Service(Windows)

显然,它可以正常工作!

1 个答案:

答案 0 :(得分:0)

.Net Core 3.1不再存在此问题。因此,请更新您的应用。