John-Luke Laue
John-Luke Laue

Reputation: 3856

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

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?

Upvotes: 4

Views: 5621

Answers (2)

trueboroda
trueboroda

Reputation: 2890

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

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

Upvotes: 0

t3chb0t
t3chb0t

Reputation: 18714

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.

Upvotes: 4

Related Questions