System.DllNotFoundException: Unable to load DLL 'libuv' when publishing .NET Core Website on Windows Server 2008 R2

2

I'm getting an error when publishing my .NET Core Asp.NET Web Application on a Windows Server 2008 R2. It has to do with 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)

The strange thing is, when I publish locally on my development machine, I can see the libuv.dll in the publish folder. And the application works on my local machine through IIS.

project.json framework:

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

Using these commands:

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

Any idea how I can fix this?

asp.net-core
asp.net-core-mvc
.net-core
asp.net-core-1.0
libuv
asked on Stack Overflow Sep 29, 2016 by John-Luke Laue • edited Sep 30, 2016 by John-Luke Laue

2 Answers

1

I found the reason for this error, at least what was causing it in my case now, 10 months later.

I had an older web-api project created with .net core 1.1 and found in the *.csproj file this PropertyGroup:

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

In a newer project that I created a few day ago but with the newer template and .NET Core 2.0 it looked like this:

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

Here the RuntimeIdentifier was missing. I added it to the new project and the error disappeared. Now the server starts as expected.

answered on Stack Overflow Aug 20, 2017 by t3chb0t
0

I had same problem. I solve this removing this strings from csproj

  </ItemGroup>
  <ItemGroup Condition="'$(TargetFramework)' == 'net461'">
    <Reference Include="System.ServiceModel" />
  </ItemGroup>
answered on Stack Overflow Jul 17, 2018 by trueboroda

User contributions licensed under CC BY-SA 3.0