1

I'm working on an installer for an application that deploys an ASP.Net Core 2 website on IIS. I have run into a unique issue with Windows 7 where I get the following error:

Failed to load the dll from [C:\Program Files (x86)\dotnet\host\fxr\2.1.2\hostfxr.dll], HRESULT: 0x80070057 The library hostfxr.dll was found, but loading it from C:\Program Files (x86)\dotnet\host\fxr\2.1.2\hostfxr.dll failed - Installing .NET Core prerequisites might help resolve this problem. http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409

Here are some important things to note:

My website fails to load, giving me a 500.19 error. In my development of my installer, I've found that this typically means I'm missing some Windows Features, but in this case it seems to be giving me another error.

So, the next thing I try in the situation is to manually run my website with dotnet.exe. So I'll run the following command in an elevated command prompt:

"C:\Program Files (x86)\dotnet\dotnet.exe" "C:\Path\to\my\project.dll"

That is when I get the message I quoted above. Following the link in the error sends me to a page for getting my first Net Core app going. Not very useful. Researching the error code 0x80070057. According to Microsoft, this means One or more arguments are not valid. Another Stackoverflow post on this hresult code implies that this error is telling you that the assembly is corrupted.

I thought perhaps I was running my command incorrectly and tried doing dotnet run my.dll (using the full pathing from earlier) and got the same error. I seem to only ever get this issue on Windows 7 as my testing on Windows 10 seems to work well enough. I tried repairing my installation of Net Core and reinstalling without luck.

I'm at a loss, have anyone experienced anything like this? I also have Net 4.7.2 installed on the system, and that seems to run just fine (they're obviously two different frameworks, but I figured it could be useful information).

Thanks.

Zulukas
  • 1,180
  • 1
  • 15
  • 35
  • That sounds like a missing dependency DLL, but checking my copy of hostfxr.dll it only depends on kernel32 and a number of api-ms-win-*.dll s. They look like they're installed with the OS, at least on Windows 10. Is there a Windows-7-specific version of .NET core you can try installing? And is the 32-bit version right? If that's an IIS error code, I'd expect IIS to be running in 64-bit mode – Rup Aug 10 '18 at 00:23
  • 1
    The [.NET Core 2.1 runtime supported OS versions page](https://github.com/dotnet/core/blob/master/release-notes/2.1/2.1-supported-os.md) says 7 SP1+. Does your fresh VM have SP1 or later? – Rup Aug 10 '18 at 00:25
  • Yeah, it was SP1. Apparently the system just needed all the updates to be installed and now it works fine. – Zulukas Aug 10 '18 at 19:27
  • Follow this https://stackoverflow.com/questions/50644730/failed-to-load-the-hostfxr-dll-after-install-net-core – Hank W Jul 22 '20 at 22:01

0 Answers0