System.DllNotFoundException:在Windows Server 2008 R2上发布.NET Core网站时无法加载DLL'libuv'

问题描述:

在Windows Server 2008 R2上发布我的.NET Core Asp.NET Web应用程序时出现错误。它有libuv做:System.DllNotFoundException:在Windows Server 2008 R2上发布.NET Core网站时无法加载DLL'libuv'

Unhandled Exception: System.AggregateException: One or more errors occurred. ---> System.DllNotFoundException: Unable to load DLL 'libuv': The specified module could not be found. (Exception from HRESULT: 0x8007007E) 
at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.NativeMethods.uv_loop_size() 
at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.loop_size() 
at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvLoopHandle.Init(Libuv uv) 
at Microsoft.AspNetCore.Server.Kestrel.Internal.KestrelThread.ThreadStart(Object parameter) 

奇怪的是,当我在我的开发机器上在本地发布,我可以看到libuv.dll在发布文件夹。该应用程序通过IIS在本地机器上运行。

project.json框架:

"frameworks": { 
    "net461": {} 
}, 

使用这些命令:

dotnet restore 
dotnet build 
dotnet publish --configuration Release --runtime active 

任何想法如何,我可以解决这个问题?

+0

你使用的是最终版本的asp.net-core?类似这个问题的解决方案在RC2版本中得到解决 - https://github.com/aspnet/KestrelHttpServer/issues/627 – Set

+0

这个问题的问题是标题声明它是用于核心的,但project.json文件另有说明。 – Joshua

我发现了这个错误的原因,至少在10个月后,现在是什么导致了我的情况。

我有一个较旧的网络API项目与.NET 1.1核心创建并在*.csproj文件这PropertyGroup发现:

<PropertyGroup> 
    <TargetFramework>net47</TargetFramework> 
    <RuntimeIdentifier>win7-x86</RuntimeIdentifier> 
    </PropertyGroup> 

在我创建了一些天前一个较新的项目,但与新的模板和.NET核心2.0它看起来像这样:

<PropertyGroup> 
    <TargetFramework>net47</TargetFramework> 
    </PropertyGroup> 

这里的RuntimeIdentifier丢失。我将它添加到新项目中,错误消失了。现在服务器按预期启动。