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

时间:2016-09-29 23:48:55

标签: asp.net-core asp.net-core-mvc .net-core asp.net-core-1.0 libuv

在Windows Server 2008 R2上发布.NET Core Asp.NET Web应用程序时出现错误。它与 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)

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

project.json框架:

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

使用以下命令:

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

知道如何解决这个问题吗?

2 个答案:

答案 0 :(得分:1)

我找到了这个错误的原因,至少在10个月之后我的情况下造成了这个错误。

我有一个使用.net核心1.1创建的较旧的web-api项目,并在*.csproj文件PropertyGroup中找到:

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

在我几天前创建的一个较新的项目中,但是使用较新的模板和.NET Core 2.0,它看起来像这样:

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

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

答案 1 :(得分:0)

我有同样的问题。我解决了从csproj删除此字符串的问题

  </ItemGroup>
  <ItemGroup Condition="'$(TargetFramework)' == 'net461'">
    <Reference Include="System.ServiceModel" />
  </ItemGroup>
相关问题