.netcore发布时指定服务器的系统类型
asp.net core 开发完成后发布,在IIS上面访问,直接报错 系统是windows2008
Application startup exception: System.DllNotFoundException: Unable to load DLL 'api-ms-win-core-registry-l1-1-0.dll': 找不到指定的模块。 (Exception from HRESULT: 0x8007007E) at Interop.mincore.RegOpenKeyEx(SafeRegistryHandle hKey, String lpSubKey, Int32 ulOptions, Int32 samDesired, SafeRegistryHandle& hkResult) at Microsoft.Win32.RegistryKey.InternalOpenSubKeyCore(String name, RegistryRights rights, Boolean throwOnPermissionFailure) at Microsoft.AspNetCore.DataProtection.RegistryPolicyResolver.ResolveDefaultPolicy() at Microsoft.Extensions.DependencyInjection.DataProtectionServices.<GetDefaultServices>d__0.MoveNext() at Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.TryAdd(IServiceCollection collection, IEnumerable`1 descriptors) at Microsoft.Extensions.DependencyInjection.DataProtectionServiceCollectionExtensions.AddDataProtection(IServiceCollection services) at Microsoft.Extensions.DependencyInjection.MvcViewFeaturesMvcCoreBuilderExtensions.AddViewServices(IServiceCollection services) at Microsoft.Extensions.DependencyInjection.MvcViewFeaturesMvcCoreBuilderExtensions.AddViews(IMvcCoreBuilder builder) at Microsoft.Extensions.DependencyInjection.MvcServiceCollectionExtensions.AddMvc(IServiceCollection services) at AppServiceByYc.Service.Startup.ConfigureServices(IServiceCollection services) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services) at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices() at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication() Hosting environment: Production
自己已经解决了
就是发布的时候 必须要指定 你服务器的系统类型发布 要不然 以当前的系统发布 可能会不兼容
给个群友给的 发布程序
@echo off echo 开始编译 pause dotnet restore echo 选择编译到哪个操作系统 echo 0------all echo 1------win7-x64 echo 2------win10-x64 echo 3------centos.7-x64 echo 4------osx.10.10-x64 echo 5------osx.10.11-x64 echo 6------osx.10.12-x64 echo 7------win7-x86 set /p input=操作系统: if %input%==1 ( dotnet publish -r win7-x64 -c release ) if %input%==2 ( dotnet publish -r win10-x64 -c release ) if %input%==3 ( dotnet publish -r centos.7-x64 -c release ) if %input%==4 ( dotnet publish -r osx.10.10-x64 -c release ) if %input%==5 ( dotnet publish -r osx.10.11-x64 -c release ) if %input%==6 ( dotnet publish -r osx.10.12-x64 -c release ) if %input%==7 ( dotnet publish -r win7-x86 -c release ) if %input%==0 ( dotnet publish -r win7-x64 -c release dotnet publish -r win10-x64 -c release dotnet publish -r centos.7-x64 -c release dotnet publish -r osx.10.10-x64 -c release dotnet publish -r osx.10.11-x64 -c release dotnet publish -r osx.10.12-x64 -c release dotnet publish -r win7-x86 -c release ) echo 按任意键退出 pause
关注我】。(●'◡'●)
如果,您希望更容易地发现我的新博客,不妨点击一下绿色通道的【因为,我的写作热情也离不开您的肯定与支持,感谢您的阅读,我是【Jack_孟】!
本文来自博客园,作者:jack_Meng,转载请注明原文链接:https://www.cnblogs.com/mq0036/p/10987045.html
【免责声明】本文来自源于网络,如涉及版权或侵权问题,请及时联系我们,我们将第一时间删除或更改!
分类:
Asp.Net Core
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
2015-06-06 vbs查看系统开关机时间