runtime: WinHttpHandler causing “Unable to load DLL 'api-ms-win-core-localization-l1-2-0.dll'” error on production server

We’ve started using the WinHttpHandler NuGet package in an ASP.NET application. On the development machines it’s working fine, and also works on our staging environment. The application targets .NET 4.6.1.

However, on production it throws the following error:

System.DllNotFoundException: Unable to load DLL 'api-ms-win-core-localization-l1-2-0.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

I have googled quite a lot about this problem, but couldn’t find any meaningful information about this dll. (I found in forums that some people manually copied the dlls to their production servers when having similar issues, but that doesn’t seem to be the proper solution.)

Where is this dll coming from? Should it be explicitly installed?

(On my dev machine I found it in C:\Windows\System32, on our staging machine it’s in C:\Windows\System32\downlevel, but I don’t know where it’s coming from.)

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 1
  • Comments: 39 (23 by maintainers)

Most upvoted comments

I don’t know how long term this solution is, but installing Visual C++ Redistributable for Visual Studio 2015 solved the issue.

(This is what I installed:

  1. Clean Windows Server 2008 R2
  2. All Windows updates
  3. Windows Server 2008 R2 Service Pack 1
  4. Web server role (to get IIS) with the Application Development features
  5. .NET Framework Redistributable 4.6.1
    At this point my site was working but I got the Unable to load DLL 'api-ms-win-core-localization-l1-2-0.dll' error when using WinHttpHandler.
  6. Visual C++ Redistributable for Visual Studio 2015
    Now WinHttpHandler is working properly.)

cc @weshaggard @davidsh @ericstj

I’d like to hear from @weshaggard and @gkhanna79 what the overall strategy is for PInvokes on Windows for portable libraries. Are we still getting any value out of API sets?