在Nano Server上运行ASP.NET 5抛出“无法加载DLL'kernel32'”

问题描述 投票:3回答:2

我已经基于ASP.NET 5 beta 8 Visual Studio模板创建了一个简单的ASP.NET 5项目。

我已经使用此命令发布了该项目

dnu publish <path to project.json> --out <path to publish folder> --configuration Release --runtime dnx-coreclr-win-x64.1.0.0-beta8 --wwwroot-out "wwwroot" --no-source

在纳米服务器上运行web.cmd之后,我收到此错误:

.\web.cmd : System.DllNotFoundException: Unable to load DLL 'kernel32': The specified module could not be found. (Exception from HRESULT: 
0x8007007E)
    + CategoryInfo          : NotSpecified: (System.DllNotFo...LT: 0x8007007E):String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

   at Microsoft.AspNet.Server.Kestrel.Networking.PlatformApis.WindowsApis.LoadLibrary(String dllToLoad)
   at Micros
oft.AspNet.Server.Kestrel.Networking.Libuv.Load(String dllToLoad)
   at Microsoft.AspNet.Server.Kestrel.ServerFactory.Start(IFeatureCollection serverFeatures, Func`2 application)
   at Microsoft.AspNet.Hosting.Internal.HostingEngine.Start()
   at Microsoft.AspNet.Hosting.Program.Main(String[] args)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly, String[] args, IServiceProvider serviceProvider)
   at Microsoft.Dnx.ApplicationHost.Program.ExecuteMain(DefaultHost host, String applicationName, String[] args)
   at Microsoft.Dnx.ApplicationHost.Program.Main(String[] args)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly, String[] args, IServiceProvider serviceProvider)
   at Microsoft.Dnx.Host.Bootstrapper.RunAsync(List`1 args, IRuntimeEnvironment env, String appBase, FrameworkName targetFramework)
   at Microsoft.Dnx.Host.RuntimeBootstrapper.ExecuteAsync(String[] args, BootstrapperContext bootstrapperContext)
   at Microsoft.Dnx.Host.RuntimeBootstrapper.Execute(String[] args, BootstrapperContext bootstrapperContext)

在Windows 10上运行时,同一命令不会引发此错误。该应用程序在Windows 10上可以正常工作。

asp.net-core asp.net-core-mvc dnx windows-server-2016 nano-server
2个回答
1
投票

Nano Server没有kernel32.dll和advapi32.dll,因此未针对默认库链接的代码将不起作用。您需要将代码链接到onecore.lib或安装反向转发器。


0
投票

假设

© www.soinside.com 2019 - 2024. All rights reserved.