ASP.NET Core 1.0 on IIS error 502.5


I just updated my server (Windows 2012R2) to .Net Core 1.0 RTM Windows Hosting pack from the previous .Net Core 1.0 RC2. My app works on my PC without any issues but the server keeps showing:

HTTP Error 502.5 - Process Failure

Common causes of this issue:

The application process failed to start
The application process started but then stopped
The application process started but failed to listen on the configured port

It previously worked with the RC2 version. Don't know what could go wrong.

This is all event viewer says:

Failed to start process with the commandline 'dotnet .\MyWebApp.dll'. Error code = '0x80004005'.

the worst part is that app logs are empty! I mean those stdout_xxxxxxxxx.log files are completely empty and all have 0 byte size.

What should I do?? How can I know the cause of error when it's not logged??

asked on Stack Overflow Jul 27, 2016 by Vahid Amiri • edited Sep 13, 2018 by Vahid Amiri

31 Answers


I was able to fix it by running

"C:\Program Files\dotnet\dotnet.exe" "C:\fullpath\PROJECT.dll"

on the command prompt, which gave me a much more meaningful error:

"The specified framework 'Microsoft.NETCore.App', version '1.0.1' was not found. - Check application dependencies and target a framework version installed at: C:\Program Files\dotnet\shared\Microsoft.NETCore.App - The following versions are installed: 1.0.0 - Alternatively, install the framework version '1.0.1'.

As you can see, I had the wrong NET Core version installed on my server. I was able to run my application after uninstalling the previous version 1.0.0 and installing the correct version 1.0.1.

answered on Stack Overflow Feb 21, 2017 by hatsrumandcode • edited Sep 27, 2018 by ᴍᴀᴛᴛ ʙᴀᴋᴇʀ

I had the same problem, in my case it was insufficient permission of the user identity of my Application Pool, on Publishing to IIS page of doc, there is a couple of reason listed for this error:

  • If you published a self-contained application, confirm that you didn’t set a platform in buildOptions of project.json that conflicts with the publishing RID. For example, do not specify a platform of x86 and publish with an RID of win81-x64 (dotnet publish -c Release -r win81-x64). The project will publish without warning or error but fail with the above logged exceptions on the server.
  • Check the processPath attribute on the <aspNetCore> element in web.config to confirm that it is dotnet for a portable application or .\my_application.exe for a self-contained application.
  • For a portable application, dotnet.exe might not be accessible via the PATH settings. Confirm that C:\Program Files\dotnet\ exists in the System PATH settings.
  • For a portable application, dotnet.exe might not be accessible for the user identity of the Application Pool. Confirm that the AppPool user identity has access to the C:\Program Files\dotnet directory.
  • Confirm that you have correctly referenced the IIS Integration middleware by calling the .UseIISIntegration() method of the application’s WebHostBuilder().
  • If you are using the .UseUrls() extension method when self-hosting with Kestrel, confirm that it is positioned before the .UseIISIntegration() extension method on WebHostBuilder(). .UseIISIntegration() must set the Url for the reverse-proxy when running Kestrel behind IIS and not have its value overridden by .UseUrls().

In my case it was the fourth reason, I changed it by right clicking my app pool, and in advanced setting under Process Model, I set the Identity to a user with enough permission: user identity of my Application Pool

answered on Stack Overflow Jul 30, 2016 by Hamid Mosalla • edited Jul 30, 2016 by Hamid Mosalla

I got this working with a hard reset of IIS (I had only just installed the hosting package).

Turns out that just pressing 'Restart' in IIS Manager isn't enough. I just had to open a command prompt and type 'iisreset'

answered on Stack Overflow Nov 15, 2016 by michael_hook

So I got a new server, this time it's Windows 2008R2 and my app works fine.

I can't say for sure what the problem was with the old server but I have one idea.

So because I previously compiled the app without any platform in mind it gave me the dll version which only works if the target host has .Net Core Windows Hosting package installed. In my case it was installed and that was fine.

After the app didn't work I decieded to compile it as a console app with win7-x64 as runtime. This time the moment I ran the exe of my app on the server, it crashed with an error about a missing dll:

The program can't start because api-ms-win-crt-runtime-l1-1-0.dll is missing

That dll is from Universal C Runtime that's included in the Visual C++ Redistributable for Visual Studio 2015.

I tried to install that package (both x64 & x86) but it failed each time (don't know why) on Windows Server 2012 R2.

But when I tried to install them in the new server, Windows Server 2008 R2, they successfully installed. That might have been the reason behind it, but still can't say for sure.

answered on Stack Overflow Jul 30, 2016 by Vahid Amiri

I had the same issue when publishing the web app. If anybody still has this problem fixed it by changing {AppName}.runtimeconfig.json

  "runtimeOptions": {
    "framework": {
      "name": "Microsoft.NETCore.App",
      "version": "1.1.2"
    "configProperties": {
      "System.GC.Server": true

Change the version from "version": "1.1.2" to "version": "1.1.1" and everythign worked ok

answered on Stack Overflow Jun 18, 2017 by npo

I had the same problem.

To find out the exact source of it I switched on logging in web.config file:

<aspNetCore processPath="dotnet" arguments=".\MyWebService.dll" stdoutLogEnabled="**true**" stdoutLogFile=".\logs\stdout" />

and created logs subfolder in MyWebService root folder.

After restarting IIS and trying to execute API I got an error and it was missing of proper Core Runtime. After downloading an installing DotNetCore.1.0.5_1.1.2-WindowsHosting the error gone.

answered on Stack Overflow Nov 25, 2017 by Eduard Silantiev

Had the same issue and all solutions didn't work. Found this gem and thought I'd pass along if it helps someone else. Install on Server 2012 R2 getting the DLL missing error, try to reinstall VS C++ 2015 and get an error. Fix is to do the following:

Seems the file C:\ProgramData\Package Cache\...\packages\Patch\x64\Windows8.1-KB2999226-x64.msu has problems being installed. Open admin command prompt do:

mkdir tmp
mkdir tmp\tmp
move "C:\ProgramData\Package Cache\...\packages\Patch\x64\Windows8.1-KB2999226-x64.msu" c:\tmp
expand -F:* c:\tmp\Windows8.1-KB2999226-x64.msu c:\tmp\tmp
dism /online /add-package /packagepath:c:\tmp\tmp\

NOTE: replace the "..." with the correct folder name. After this reinstall the VS C++ 2015 package.

answered on Stack Overflow Dec 14, 2016 by Lee Harris

I got this issue on my production server after my VS project was automatically upgraded to .NET Core 1.1.2.

I simply installed the 1.1.2 .net core runtime from here on my production server:

answered on Stack Overflow Sep 6, 2017 by Rikard Askelöf

SOLVED I just ran through the same issue today while deploying to AZURE. Then I tried the same for local IIS, got the same issue. As I am new to .net CORE, struggled few hour before I actually solved it.

In our solution, after I publish to IIS, I observed my web.confile file, specially below line <aspNetCore processPath="bin\IISSupport\VSIISExeLauncher.exe" arguments="-argFile IISExeLauncherArgs.txt" forwardWindowsAuthToken="false" stdoutLogEnabled="false" />

In our deployment folder the generated web.config looks like:<aspNetCore processPath="dotnet" arguments=".\Yodlee.dll -argFile IISExeLauncherArgs.txt" forwardWindowsAuthToken="false" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />

Now PLEASE try changing the above configuration in visual studio solution to<aspNetCore processPath="bin\IISSupport\VSIISExeLauncher.exe" forwardWindowsAuthToken="false" stdoutLogEnabled="false" />

In our new deployment folder the generated web.config looks like:<aspNetCore processPath="dotnet" arguments=".\Yodlee.dll" forwardWindowsAuthToken="false" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />

And This SOLVED my problem, Hope it help.

answered on Stack Overflow Feb 13, 2018 by Agni

I had the same problem when I updated my dev machine to Core 1.0.1, but forgot to update the server.

answered on Stack Overflow Nov 4, 2016 by Alex Dresko

I had a similar issue, and to quote Sherlock Holmes: "when you have eliminated the impossible, whatever remains, however improbable, must be the truth?"

I checked if the .NET framework I was targeting was installed on the server, and it turns out it wasn't. I installed the 4.6.2 .NET Framework and it worked.

answered on Stack Overflow Jan 13, 2017 by TheDoctor05 • edited Jan 13, 2017 by bfontaine

I was getting HTTP Error 502.5 while trying to publish my .NET Core 2.0 API to AWS EB, and solved it by adding the following code to the .csproj:

answered on Stack Overflow Jan 15, 2018 by Matheus Lacerda

I had a same issue . I changed application pool identity to network service account . Then I explicitly set the path to dotnet.exe in the web.config for the application to work properly as @danielyewright said in his github comment . It works after set the path.


answered on Stack Overflow Nov 28, 2016 by vik

Sharing that in my case this error was because i forgot to update project.json with:

"buildOptions": {
    "emitEntryPoint": true
answered on Stack Overflow Dec 9, 2016 by vinjenzo

I had the same error in question, with the same issues as described by VSG24 in Proposed answer - nasty error message when typing 'dotnet' into CMD:

The program can't start because api-ms-win-crt-runtime-l1-1-0.dll is missing

I solved this by manually installing the following 2 updates on Windows Server 2012 R2 (and the pre-requisites and all the other updates linked - read the installation instructions carefully on the Microsoft website):

  1. KB2919355
  2. KB2999226

Hope this helps someone.

answered on Stack Overflow Mar 23, 2017 by Johan Foley

I faced the same issue when I tried to publish Debug version of my web application. This set of files didn't contain the file web.config with the proper value of attribute processPath.

I took this file from Release version, value was assigned to the path to my exe file.

<aspNetCore processPath=".\My.Web.App.exe" ... />
answered on Stack Overflow May 12, 2017 by Barabas

In my case was problem with Net Core version installed on server. I just install the same version as on my development machine and everything is OK :-)

answered on Stack Overflow Jun 2, 2017 by SaltFish • edited Jun 2, 2017 by SaltFish

In my case, after installing AspNetCore.2.0.6.RuntimePackageStore_x64.exe and DotNetCore.2.0.6-WindowsHosting.exe , I need to restart server to make it worked without 502 bad gateway and proxy error.


There is a way you could use it without restart:

answered on Stack Overflow Apr 12, 2018 by John_J • edited Jun 15, 2018 by John_J

I needed to install the latest .net Core version found here. No need to restart the site or server


I solved it by adding "edit permission" to the application of the site, mapped to the physical directory and then selected the windows user that could have access to this root folder. (private network).

answered on Stack Overflow May 24, 2018 by Antonin GAVREL

Open command prompt with Administrator credentials

Type following command and hit enter



Open Visual Studio 2017 with Administrator credentials

Type following command in Package Manager Console and hit enter


Attempting stop...
Internet services successfully stopped
Attempting start...
Internet services successfully restarted
answered on Stack Overflow Dec 13, 2018 by Akshay Mishra

For me it was caused by having different versions of .Net Core installed. I matched my dev and production server and it worked.

answered on Stack Overflow Dec 30, 2018 by Carla

I had this problem aswell (The error occurred both on VS 15 and 17). However on VS15 it returned a CONNECTION_REFUSED error and on VS17 it returned ASP.NET Core 1.0 on IIS error 502.5.


  1. Navigate to your project directory and locate the hidden folder .vs (it's located in the projects folder dir). (Remember to show hidden files/folders)

  2. Close VS

  3. Delete .vs-folder
  4. Start VS as admin (.vs-folder will be recreated by VS)
answered on Stack Overflow Mar 30, 2017 by Unicco

Here is what I figured, and this happened recently on Windows 10 after an update was installed. From what I gathered, a Windows Defender update was installed which assumed my "Project.dll"(an core project) behaved like a virus so it was deleted.

So, one of the first things I suggest you do before you start installing/uninstalling stuffs is to check to confirm your "Project.dll" is where it should be.

Copy it back to the location if it is no longer there.

If you are having difficulty copying the file back add an exclusion to your project folder in windows defender. ( Learn how to do that here. )

This worked for me instantly, and I repeated it across application multiple servers.

answered on Stack Overflow Oct 10, 2017 by Seun S. Lawal

For me it was that the connectionString in Startup.cs was null in:

services.AddDbContext<ApplicationDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));

and it was null because the application was not looking into appsettings.json for the connection string.

Had to change Program.cs to:

public static void Main(string[] args)

public static IWebHost BuildWebHost(string[] args) =>
     .ConfigureAppConfiguration((context, builder) => builder.SetBasePath(context.HostingEnvironment.ContentRootPath)
answered on Stack Overflow Dec 13, 2017 by Andrei Dobrin

I have no idea why this worked for me, but I am using Windows Authentication and I had this bit of code on my BuildWebHost in Program.cs:

.UseHttpSys(options =>
    options.Authentication.Schemes =
        AuthenticationSchemes.NTLM | AuthenticationSchemes.Negotiate;
    options.Authentication.AllowAnonymous = false;

After removing the .UserHttpSys bit, it now works, and I can still authenticate as a domain user.

BuildWebHost now looks like

public static IWebHost BuildWebHost(string[] args) =>
answered on Stack Overflow Jan 14, 2018 by Bassie

I was getting the same error, and found out the problem was that during the publish to Azure, my web.config file was modified so this following line ended up like this:

<aspNetCore processPath="bin\IISSupport\VSIISExeLauncher.exe" arguments="-argFile IISExeLauncherArgs.txt" forwardWindowsAuthToken="false" stdoutLogEnabled="false" startupTimeLimit="3600" requestTimeout="23:00:00" />

The problem for Production are the contents of the arguments: "-argFile IISExeLauncherArgs.txt"

It seems like this issue is going to be addressed in the next .NET Core SDK (currently in preview), but for now, the workaround is to add this block to the .csproj file:

<Target Name="bug_242_workaround" AfterTargets="_TransformWebConfig">
    <Exec Command="powershell &quot;(Get-Content '$(PublishDir)Web.config').replace(' -argFile IISExeLauncherArgs.txt', '') | Set-Content '$(PublishDir)Web.config'&quot;" />

This will modify the web.config and remove the problematic part for publishing.


Hope it helps.

answered on Stack Overflow Apr 6, 2018 by Rodrigo Pires

Worked for me after changing the publishing configuration.

enter image description here

answered on Stack Overflow Nov 27, 2018 by MAFAIZ

I had a similar issue (Asp.Net Core 2.x) that was caused by trying to run a 32-bit core app in IIS on a 64-bit windows server. The root cause was that the web.config that is auto-generated (if your project does not explicitly include one, which core projects do not by default) does not contain the full path to the dotnet executable. When you install the hosting bundle on a 64 bit machine it will install the 64 and 32 bit versions of dotnet, but the path will resolve by default to 64 bit and your 32 bit core app will fail to load. In your browser you may see a 502.5 error and if you look the server event log you might see error code 0x80004005. If you try to run dotnet.exe from a command prompt to load your core application dll on that server you may see an error like "BadImageFormatException" or "attempt was made to load a program with an incorrect format". The fix that worked for me was to add a web.config to my project (and deployment) and in that web.config set the full path to the 32-bit version of dotnet.exe.

<?xml version="1.0" encoding="utf-8"?>
    <location path="." inheritInChildApplications="false">
                <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
            <aspNetCore processPath="C:\Program Files (x86)\dotnet\dotnet.exe" arguments=".\My32BitAspNetCoreApp.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
answered on Stack Overflow Nov 30, 2018 by Nathan

I got the same problem and the reason in my case was that the EF core was trying to read connection string from appsettings.development.json file. I opened it and found the connection string was commented.

//  "ConnectionStrings": {
//    "DefaultConnection": "Server=vaio;Database=Goldentaurus;Trusted_Connection=True;",
//    "IdentityConnection": "Server=vaio;Database=GTIdentity;Trusted_Connection=True;"
//  }

I then uncommitted them like below and the problem solved:

  "ConnectionStrings": {
    "DefaultConnection": "Server=vaio;Database=Goldentaurus;Trusted_Connection=True;",
    "IdentityConnection": "Server=vaio;Database=GTIdentity;Trusted_Connection=True;"
answered on Stack Overflow Jan 7, 2019 by yogihosting

I changed profile options to this and it's working!!!

enter image description here

Maybe you should change this two options:

  1. Deployment Mode
  2. Target Runtime
answered on Stack Overflow Jan 31, 2019 by hosein dafeyan • edited Jan 31, 2019 by סטנלי גרונן

User contributions licensed under CC BY-SA 3.0