ASP.NET Core 1.0 on IIS error 502.5
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.
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 asp.net 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
ofproject.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 isdotnet
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 thatC:\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 theC:\Program Files\dotnet
directory. - Confirm that you have correctly referenced the IIS Integration middleware by calling the
.UseIISIntegration()
method of the application’sWebHostBuilder()
. - If you are using the
.UseUrls()
extension method when self-hosting with Kestrel, confirm that it is positioned before the.UseIISIntegration()
extension method onWebHostBuilder()
..UseIISIntegration()
must set theUrl
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: