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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With