asp.net core 開發完成後發佈,在IIS上面訪問,直接報錯 系統是windows2008windows
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
本身已經解決了
就是發佈的時候 必需要指定 你服務器的系統類型發佈 要否則 以當前的系統發佈 可能會不兼容
給個羣友給的 發佈程序centos
@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