While deploying asp.net Core 2 to IIS, you may get one of these errors or both
500.19 Internal Server error
The first of the issue is 500.19 error when trying to host an asp.net core 2.0 application inside IIS7. What you get might be something like below
Related Articles
This one was quite simple,turned out to be ANCM (ASP.NET CORE MODULE) module and related configuration was not correctly recognized by IIS. This can be fixed by installing the .NET Core Windows Server Hosting bundle .
By installing the .NET CORE Server Hosting bundle ,it added the ANCM module correctly to IIS .When you install the ANCM module,,it will copy dlls and schema files to as follows
C:WindowsSystem32inetsrvaspnetcore.dll C:WindowsSystem32inetsrvconfigschemaaspnetcore_schema.xml
If you are running IIS application pool on 32 bit ,you should also see it under
C:WindowsSysWOW64inetsrvaspnetcore.dll.
It will also add the required configuration changes to ApplicationHost.Config(C:WindowsSystem32inetsrvconfig) file.You should see AspNetCoreModule in the globalModules section.
HTTP Error 502.5 - Process Failure
This error will be like this
If the ASP.NET Core Module fails to start, a 502.5 Process Failure status code page appears. This can be caused by multiple reasons
- ASP.NET Core Module fails to launch the backend process - This could be because an exception occured in your asp.net core startup.cs
- The backend .NET Core process starts but fails to listen on the configured port - You can refer my other blog entry for a similar issue
You web.config will be
- stdoutLogEnabled should be enabled and look for a log files in the stdoutLogFile location you specified in your web.config file. If this folder is not there,do create the folder and reproduce the issue .
- Please note that if you have
disableStartUpErrorPage
setting enabled, you will just get regular 502 error page of IIS and not this specific page - If you don't see anything in the log file,you can add ASPNETCORE_ENVIRONMENT environment variable and also enable developer exception page in your startup.cs
aspNetCore processPath="dotnet" arguments=".MyApp.dll" stdoutLogEnabled="false" stdoutLogFile="\?%home%LogFilesstdout">
environmentVariables>
environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
environmentVariables>
aspNetCore>
and the startup.cs Configure method should have
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); }
After this,you should see the developer exception page in your application which should tell you what is the error your application is running into.
Hope it helps!
This post first appeared on MSDN Blogs | Get The Latest Information, Insights, Announcements, And News From Microsoft Experts And Developers In The MSDN Blogs., please read the originial post: here