I've been trawling through related questions for several weeks looking for an answer, and none of the previous solutions are working for me. I know this is a common (and vague) problem.
I'm hosting a web app in IIS on Windows Server 2016. The application is built in VS2019 and runs fine in IIS Express. The default web site hosted by IIS is working, but when I add a second site pointing to my published application, I'm getting a 500 error.
However, when I check the IIS logs, all I see are 200 responses, which is odd. There is also no error in Event Viewer to give me more details. The best lead I have found so far is that the problem may be caused by the web.config file.
The generated XML is this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\MalechusDotCom.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: bc59438b-f089-4db2-98d6-cc60312db351-->
Is there anything else I can check to try to isolate the issue?
I got similar problem . setting dotnet exe complete path resolved my problem. Try this one:
<aspNetCore processPath="C:\Program Files\dotnet\dotnet.exe" arguments=".\MalechusDotCom.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" />
Update above line of code with complete processPath value. Make sure C:\Program Files\dotnet\dotnet.exe path exist in your system or find equivalent path. this vary system to system.
Related
Before opening this ticket, I read dozens of other questions here on StackOverflow, youtube etc, but all suggestions that I found not solve my problem.
What I intend is to host a .net core 6 web api on windows server 2016 using IIS.
I've managed to host a client site (Angular) without problems, but the API always gives me a 500.19 error:
I have configured port 5041, but I have already tried with others, such as 80, 8080 without success.
I already have installed the Asp.Net Core Runtime and Hosting Bundle:
This is my web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\EvoStats.API.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
I saw someone else who solved your problem by putting the full path of dotnet, I did that too, but it didn't solve in my case:
<aspNetCore processPath="C:\Program Files\dotnet\dotnet.exe" ...
I also configured the Application Pool to not manage the code using .net CLR
I don't know what I can do more :(
I appreciate your help.
I already managed to solve it.
The problem was with the access permissions to the wwwroot folder.
Something strange, because I have a site (Angular) working on this folder, before giving Full Control to the user IIS_IUSRS.
Hope this solution helps others.
I'm trying to get a basic .NET 5.0 app running on a new dev server and it is giving me an error trying to read the web.config with no Config Error.
The hosting framework is installed
And the App Pool user and folder path are the defaults.
I even ran Process Monitor and the file is successfully read, so it's the content that is giving it a hard time. This is the web.config content.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\TestApp.Web.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
The environment variable has been set as well
There are also no errors in the Event Viewer.
Thoughts?
--- EDIT ---
The file shows the IIS user as having access
I fixed it with a repair install of the Hosting framework install
From what I understand this error occurs when the web.config is not configured properly. However when I publish the app the following web.config gets generated
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\Lotus.Server.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 85a43eb6-3576-401d-b025-a15a2cc377b6-->
I first thought of installing URL Rewrite, this did not solve the problem. I am stressing out have tried almost everything any ideas on how to resolve it?
The error page looks like this:
I had this same problem and I was trying to fix it for 4 days. Then I found the solution.
Firstly you need to download dotnet hosting 2.2.2
https://dotnet.microsoft.com/download/dotnet-core/thank-you/runtime-aspnetcore-2.2.2-windows-hosting-bundle-installer
Then after instalation try to restart IIS with cmd (run as admin and then write iisreset).
If error page has changed we are going in good direction :)
Now it should say that you are using wrong module (which indeed is true).
Open IIS, get to your website and check installed modules. On list you should be able to see AspNetCoreModule but not AspNetCoreModuleV2.
go to:
%ProgramFiles%\IIS\Asp.Net Core Module\V2\
and copy aspnetcorev2.dll
Then go into %SystemRoot%\system32\inetsrv\ and paste it
Now after this, open config folder in %SystemRoot%\system32\inetsrv\ and then open applicationHost.
IMPORTANT
At this stage you need to turn off your iis
Now find this line:
<add name="AspNetCoreModule" image="%SystemRoot%\system32\inetsrv\aspnetcore.dll" />
and add under it:
<add name="AspNetCoreModuleV2" image="%SystemRoot%\system32\inetsrv\aspnetcorev2.dll" />
And this same goes with this one:
<add name="AspNetCoreModule" />
add under it:
<add name="AspNetCoreModuleV2" />
Now save it, overwrite old one, and enable IIS. Go to your website, check modules and at the list you should be able to see AspNetCoreModuleV2:
AspNetCoreModule and AspNetCoreModuleV2 on list
For me It was lacking the Url Rewrite Module
https://www.freecodecamp.org/news/how-to-deploy-a-blazor-application-on-internet-information-services-iis-f96f2969fdcb/
Fixed this by changing "AspNetCoreModuleV2" to "AspNetCoreModule" in the generated web.config in my publish folder, i.e., from
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
to
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
This had me scratching my head for a while as everything was working fine on LocalHost - the error occured on the production server.
After rebuilding the site I realised that I had deleted the site folder on the production server along with its contents.
When I replaced the site I had posted it to my server node without recreating the site folder, so obviously the server couldn't access my web.config file as it was unbable to find the site folder.
Lesson learnt! Hope it saves other running down the 500.19 rabbit hole.
I am trying to deploy an Asp.net boilerplate app on azure and I have already deployed my backend and the Swagger application is working fine, when I try to also deploy the Angular frontend I keep getting this error: HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure.
I have found other threads discussing this problem, but since I am using the ASP.NET Boilerplate framework i do not have a .exe or .dll file that I can run to start the Web.Host project, not that I'm aware of atleast.
The logs in Kudu show this: Application '/LM/W3SVC/288745522/ROOT' with physical root 'D:\home\site\wwwroot\' failed to start process with commandline '%LAUNCHER_PATH% %LAUNCHER_ARGS%'.
It probably has something to do with those %LAUNCHER% variables not being found, I have found some other threads suggesting your should replace the LAUNCHER_ROOT [projectname].exe or [projectname].dll but I cant seem to find these in my project. This might be because of the way ASP.NET Boilerplate is built up.
This is my web.config:
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" startupTimeLimit="3600" requestTimeout="23:00:00">
<environmentVariables />
</aspNetCore>
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
Error message indicates that the ASP.NET Core Module attempts to start the worker process but it fails to start. The cause of a process startup failure can usually be reviewed from entries in the Application Event Log and the ASP.NET Core Module stdout log. Both logs can be found on the Kudu/SCM site in d:\home\Logfiles. In your web.config file located in the wwwroot folder, enable stdout logs, as so:
Web.config sample:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\MyApplicationAssembly.dll" stdoutLogEnabled="true"
stdoutLogFile="\\?\%home%\LogFiles\stdout" forwardWindowsAuthToken="false" />
</system.webServer>
</configuration>
Please check the eventlog.xml and the stdout logs you have collected.
Reference: https://blogs.msdn.microsoft.com/waws/2018/06/10/troubleshooting-http-502-5-startup-issues-in-azure-appservice-for-asp-net-core-websites/
Additional troubleshooting methods for ASP.Net at
https://learn.microsoft.com/en-us/aspnet/core/test/troubleshoot-azure-iis?view=aspnetcore-2.2#troubleshoot-on-azure-app-service.
Hope it helps.
I get this error when I access my app which I published to local IIS:
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
My web.config is really simple:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\TreesOnMars.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 14bfa9ba-0bd6-4ae2-a6f4-6e3e91d35263-->
What could be wrong? I tried giving all users permission to read my c:\inetpub\wwwroot folder... the web.config doesn't have any obvious error in it! I tried some of the solutions at this question but they didn't work...
You need to install the .NET Core hosting bundle to host .NET Core apps in IIS. The bundle installs the .NET Core Runtime, .NET Core Library, and the ASP.NET Core Module. The link to the .NET Core 2.1 hosting bundle is here: https://www.microsoft.com/net/download/thank-you/dotnet-runtime-2.1.3-windows-hosting-bundle-installer
Also make sure the following Windows features are enabled:
More information can be found here:
https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-2.1&tabs=aspnetcore2x