【问题标题】:System.DllNotFoundException: Unable to load DLL 'libuv' when publishing .NET Core Website on Windows Server 2008 R2System.DllNotFoundException:在 Windows Server 2008 R2 上发布 .NET Core 网站时无法加载 DLL“libuv”
【发布时间】:2017-02-08 10:50:12
【问题描述】:

在 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)

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

project.json 框架:

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

使用这些命令:

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

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

【问题讨论】:

  • 您使用的是 asp.net-core 的最终版本吗?类似这个问题的接缝已在 RC2 版本中修复 - github.com/aspnet/KestrelHttpServer/issues/627
  • 这个问题的问题是标题声明它是核心,但 project.json 文件显示其他情况。

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


【解决方案1】:

我找到了这个错误的原因,至少在我现在的情况下是什么原因,10 个月后。

我使用 .net core 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。我将它添加到新项目中,错误消失了。现在服务器按预期启动。

【讨论】:

    【解决方案2】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-21
      • 1970-01-01
      • 1970-01-01
      • 2012-09-23
      • 1970-01-01
      • 2012-04-12
      相关资源
      最近更新 更多