使用现有的 .NET 5 MVC Web 应用程序,我尝试升级到 .NET 6,但遇到此错误。我还使用 IIS 进行 Windows 身份验证——现在在 .NET 6 中设置为“属性”-> 调试 -> 超链接(打开调试启动配置文件 UI)下的“配置文件”。我还包含了较新的“Microsoft.AspNetCore.Authentication.Negotiate”Nuget 包(和相关代码)来处理较新的 Windows 身份验证库。
当 Web 应用程序启动时,我收到以下错误:
An unhandled exception occurred while processing the request.
InvalidOperationException: Cannot find compilation library location for package 'System.Security.Cryptography.Pkcs'
Microsoft.Extensions.DependencyModel.CompilationLibrary.ResolveReferencePaths(ICompilationAssemblyResolver resolver, List assemblies) Microsoft.Extensions.DependencyModel.CompilationLibrary.ResolveReferencePaths() Microsoft.AspNetCore.Mvc.ApplicationParts.AssemblyPartExtensions+<>c.b__0_0(CompilationLibrary library) System.Linq.Enumerable+SelectManySingleSelectorIterator<TSource, TResult>.MoveNext()
...
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
如果我添加列出的包,这不会消失: System.Security.Cryptography.Pkcs
最佳答案
我需要删除 至少 1 Nuget 包 :
关于c# - 升级到 .NET 6 时,Web Project 抛出运行时异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69919514/