是否存在名为 Microsoft.AspNetCore.Mvc.Components.Prerendering 的块包或程序集?
Exist a nugget package or assembly called Microsoft.AspNetCore.Mvc.Components.Prerendering?
我开始将我的 netcore 项目从 2.2 迁移到 3.0 预览版 8,当我尝试启动它时(asp.net 核心项目),特别是在启动时添加 Mvc class:
services.AddMvc();
抛出错误:
System.IO.FileNotFoundException
HResult=0x80070002
Message=Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Components.Prerendering, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
Source=System.Private.CoreLib
StackTrace:
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, RuntimeAssembly assemblyContext, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, AssemblyLoadContext assemblyLoadContext)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, StackCrawlMark& stackMark, AssemblyLoadContext assemblyLoadContext)
at System.Reflection.Assembly.Load(String assemblyString)
at Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartManager.<>c.<GetApplicationPartAssemblies>b__8_0(ApplicationPartAttribute name)
at System.Linq.Enumerable.SelectArrayIterator`2.ToArray()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.OrderedEnumerable`1.<GetEnumerator>d__16.MoveNext()
at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext()
at System.Linq.Enumerable.ConcatIterator`1.MoveNext()
at Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartManager.PopulateDefaultParts(String entryAssemblyName)
at Microsoft.Extensions.DependencyInjection.MvcCoreServiceCollectionExtensions.GetApplicationPartManager(IServiceCollection services)
at Microsoft.Extensions.DependencyInjection.MvcCoreServiceCollectionExtensions.AddMvcCore(IServiceCollection services)
at Microsoft.Extensions.DependencyInjection.MvcServiceCollectionExtensions.AddControllersCore(IServiceCollection services)
at Microsoft.Extensions.DependencyInjection.MvcServiceCollectionExtensions.AddControllersWithViewsCore(IServiceCollection services)
at Microsoft.Extensions.DependencyInjection.MvcServiceCollectionExtensions.AddControllersWithViews(IServiceCollection services)
at Microsoft.Extensions.DependencyInjection.MvcServiceCollectionExtensions.AddMvc(IServiceCollection services)
at Catalog.Api.Startup.ConfigureServices(IServiceCollection services) in <path to source code>:line 76
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass9_0.<Invoke>g__Startup|0(IServiceCollection serviceCollection)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass8_0.<Build>b__0(IServiceCollection services)
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(Type startupType, HostBuilderContext context, IServiceCollection services)
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass12_0.<UseStartup>b__0(HostBuilderContext context, IServiceCollection services)
at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
at Microsoft.Extensions.Hosting.HostBuilder.Build()
at Catalog.Api.Program.Main(String[] args) in <path to source code> 27
找了好久好像没有这个错误,包也不存在
我想通了,
我用的是 Asp.Net 核心的最后一张图片
mcr.microsoft.com/dotnet/core-nightly/aspnet:3.0.0-preview9
但是旧版本的 SDK
mcr.microsoft.com/dotnet/core/sdk:3.0.100-preview8
我的解决方案是将 Asp.Net 核心移动到预览版 8,现在一切正常。
我迁移到 preview9,但在我的 debian 服务器上出现此错误
我将带有 dll 的 ubuntu zip 通过管道传输到我的 debian 服务器
使用预览版 8 没有问题
我发现了这个:
还有这个;
提议的产品更改
这些更改最晚可以在预览版 9 中进行 - 但越早越好
我们应该从服务器中删除有状态预渲染的功能。我们不建议在任何生产场景中使用它,因此我们应该删除该功能。
可以删除 Microsoft.AspNetCore.Mvc.Components.Prerendering 包。
RenderStaticComponentAsync 方法应重命名为 RenderComponentAsync。
可以根据需要清理各种实现部分。我们现在无法预测我们是否会以相同的方式恢复相同的功能,所以最干净的做法是删除所有不需要的功能。
编辑:
有了 RC 就可以了
我开始将我的 netcore 项目从 2.2 迁移到 3.0 预览版 8,当我尝试启动它时(asp.net 核心项目),特别是在启动时添加 Mvc class:
services.AddMvc();
抛出错误:
System.IO.FileNotFoundException
HResult=0x80070002
Message=Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Components.Prerendering, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
Source=System.Private.CoreLib
StackTrace:
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, RuntimeAssembly assemblyContext, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, AssemblyLoadContext assemblyLoadContext)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, StackCrawlMark& stackMark, AssemblyLoadContext assemblyLoadContext)
at System.Reflection.Assembly.Load(String assemblyString)
at Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartManager.<>c.<GetApplicationPartAssemblies>b__8_0(ApplicationPartAttribute name)
at System.Linq.Enumerable.SelectArrayIterator`2.ToArray()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.OrderedEnumerable`1.<GetEnumerator>d__16.MoveNext()
at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext()
at System.Linq.Enumerable.ConcatIterator`1.MoveNext()
at Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartManager.PopulateDefaultParts(String entryAssemblyName)
at Microsoft.Extensions.DependencyInjection.MvcCoreServiceCollectionExtensions.GetApplicationPartManager(IServiceCollection services)
at Microsoft.Extensions.DependencyInjection.MvcCoreServiceCollectionExtensions.AddMvcCore(IServiceCollection services)
at Microsoft.Extensions.DependencyInjection.MvcServiceCollectionExtensions.AddControllersCore(IServiceCollection services)
at Microsoft.Extensions.DependencyInjection.MvcServiceCollectionExtensions.AddControllersWithViewsCore(IServiceCollection services)
at Microsoft.Extensions.DependencyInjection.MvcServiceCollectionExtensions.AddControllersWithViews(IServiceCollection services)
at Microsoft.Extensions.DependencyInjection.MvcServiceCollectionExtensions.AddMvc(IServiceCollection services)
at Catalog.Api.Startup.ConfigureServices(IServiceCollection services) in <path to source code>:line 76
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass9_0.<Invoke>g__Startup|0(IServiceCollection serviceCollection)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass8_0.<Build>b__0(IServiceCollection services)
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(Type startupType, HostBuilderContext context, IServiceCollection services)
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass12_0.<UseStartup>b__0(HostBuilderContext context, IServiceCollection services)
at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
at Microsoft.Extensions.Hosting.HostBuilder.Build()
at Catalog.Api.Program.Main(String[] args) in <path to source code> 27
找了好久好像没有这个错误,包也不存在
我想通了,
我用的是 Asp.Net 核心的最后一张图片
mcr.microsoft.com/dotnet/core-nightly/aspnet:3.0.0-preview9
但是旧版本的 SDK
mcr.microsoft.com/dotnet/core/sdk:3.0.100-preview8
我的解决方案是将 Asp.Net 核心移动到预览版 8,现在一切正常。
我迁移到 preview9,但在我的 debian 服务器上出现此错误
我将带有 dll 的 ubuntu zip 通过管道传输到我的 debian 服务器
使用预览版 8 没有问题
我发现了这个:
还有这个;
提议的产品更改
这些更改最晚可以在预览版 9 中进行 - 但越早越好
我们应该从服务器中删除有状态预渲染的功能。我们不建议在任何生产场景中使用它,因此我们应该删除该功能。
可以删除 Microsoft.AspNetCore.Mvc.Components.Prerendering 包。
RenderStaticComponentAsync 方法应重命名为 RenderComponentAsync。
可以根据需要清理各种实现部分。我们现在无法预测我们是否会以相同的方式恢复相同的功能,所以最干净的做法是删除所有不需要的功能。
编辑:
有了 RC 就可以了