HTTP Error 500.19 - Internal Server Error when accessing website - c#

I have just uploaded an ASP.NET Core 2.1 app. I get this error when I try to run my website on IIS 8.0
Detailed Error Information:
Module IIS Web Core
Notification BeginRequest
Handler Not yet determined
Error Code 0x8007052e
Config Error Can not log on locally to
C:\Inetpub\vhosts\website-domain.my\dev.website-domain.my\MSS as user
username with virtual directory password
Config File
\?\C:\inetpub\temp\apppools\dev.website-domain.my(domain)(4.0)(pool)\dev.website-domain.my(domain)(4.0)(pool).config
Requested URL http://dev.website-domain.my:80/MSS/
Physical Path
C:\Inetpub\vhosts\website-domain.my\dev.website-domain.my\MSS\
Logon Method Not yet determined
Logon User Not yet determined
Config Source:
<application path="/MSS" applicationPool="dev.website-domain.my(domain)(4.0)(pool)">
<virtualDirectory path="/" physicalPath="C:\Inetpub\vhosts\website-domain.my\dev.website-domain.my\MSS" userName="username" password="[enc:AesProvider:4+kg/83a+hodVa/zMgLvRNQjrQjQp82oK77jfYDH0ak=:enc]" />
</application>
I have given full access control to my username user on the MSS folder but i still get this error. My application pool is showing the username user in the Identity column as well. What else am I missing? Could this be a .net core issue also?

I got I similar error when was deploying my ASP.NET Core app to IIS. The error was caused by missing IIS module AspNetCoreModuleV2.
It was fixed by installing ASP.NET Core 6.0 Runtime - https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-aspnetcore-6.0.5-windows-hosting-bundle-installer
My web.config file
<?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=".\DevOpsTestService2.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
The error I got

Related

web_Config file configuration under IIS 10

I have a site on IIS server which hosts ASP.NET REST APIs. They work on separate application pools which all have Unmanaged Code as their .NET CLR version. All .NET Core APIs .NET Core 3.1 written.
I have also installed hosting bundle, SDK, ASp.NET And Desktop SDKs as shown below.
Unfortunately the app does not work. When I investigate it seems the error is IIS/configuration related. The application I have deployed is published as follows :
And the web.config is as follows :
<?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>
<!-- The line below -->
<aspNetCore processPath=".\Unity.REST.API.WM.exe" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
With this configuration, when I try to open Configuration Manager of the site under Management tab I get the following error.
However if I remove the line under the "The line below" comment, I can view configuration, but I certainly need to keep that line to make my .NET Core REST API working.
I have copied all the files and config from another server and it works OK there. Is there any possible solution you can suggest?
In applicationhost.config, check if you have such an entry:
<section name="aspNetCore" overrideModeDefault="Allow" />
Believe it should be under <configuration> -> <configSections> -> <sectionGroup name="system.webServer">
If you don't have it, try adding it and restart IIS.
This problem occurs because the ApplicationHost.config or Web.config file contains a malformed or unidentified XML element. IIS can't identify the XML elements of the modules that are not installed. You can find probloem element by commenting some blocks and looking for type of error.
And you can also try to check whether URL rewrite is installed.
https://www.iis.net/downloads/microsoft/url-rewrite.

IIS ASP.NET Core application not starting

I have created an ASP.NET Core web api that has been tested on many PC's but when deploying to client's IIS server, the application does not start or produce any error, as checked in Application Event logs.
Running the executable directly, the application works and you can browse to the ASP.NET Core website.
I navigated to the web.config file to find the dll to run:
<?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=".\MY_API.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: c1c1b8d5-abcd-479f-9e7a-abcdefghijkl-->
running dotnet MY_API.dll produces the following:
The port is not bound to any other application, as when i run the executable, it binds to the port successfully and i can navigate to localhost:port and the api swagger interface is displayed.
The dotnet command successfully runs the application on my development PC.
I can confirm that IIS is running the same modules that i am running on my dev PC and the same .net runtime hosting bundle is installed on the server as is installed on my dev PC.
I feel that this is just a permissions issue, that the security policy perhaps is preventing me from binding ports using the dotnet command, which i have read that is what IIS uses to launch the application in the background.
My knowledge on service accounts and ApplicationPoolIdentities are very limited. What is the permissions that would prevent the application to bind the port using the dotnet command, where running the executable allows me to bind to the port? How do i change these permissions?

Deploying ASPNet core on IIS not working at all

I have published an ASP.NET Core application on IIS that won't work.
I followed these steps/tutorial: https://stackify.com/how-to-deploy-asp-net-core-to-iis/ and https://stackoverflow.com/a/646386/11498427
So this is my web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
</system.webServer>
</configuration>
Published the ASP.NET Core application with the file folder publish. Then unzipped it and put the whole folder inside: "C:\inetpub\wwwroot\"
Set the appropriate folder's with the full control permissions.
Set the appropriate authentication within IIS manager
Set the appropriate settings for the application pool.
.NET Core Server bundle correctly installed (latest, see screenshot)
'localhost' working fine. But whenever I try to reach my application it gives me a 404. Anyone knows what could be the problem? Thanks in advance.

ASP.NET Core + Framework in IIS getting HTTP 404

Ok - this is my first deployment of an ASP.NET Core app. One wrinkle to keep in mind is that I am using ASP.NET Core 2.2 and targeting Framework version 4.6.2 (not .Net Core). It all runs fine on my local machine with VS2017 and IISExpress.
I went through the procedure outlined by MS here: Host ASP.NET Core on Windows with IIS The documentation is long and complicated, but I think I covered everything. It makes one thing clear: The in-process hosting model isn't supported for ASP.NET Core apps that target the .NET Framework. So, I know I need to use Out-of-Proc.
Some other points:
I published the app to a local folder and copied it to the server without any changes.
I created the new app in the Default Web Site and gave it its own app pool - set as "No Managed Code"
Out-of-proc is the default, so I have not done any special config for this.
I have confirmed that AspNetCoreModuleV2 appears in the list of Modules.
The Result
Every page I hit I get HTTP404. I am running IE locally on the server and using a URL like: http://localhost/MyApp/Home/MyView
The application pool shows having 1 application running.
The App Event Log shows a message like: Application '/LM/W3SVC/2/ROOT/MyApp' started process '8864' successfully and process '8864' is listening on port '37706'. It shows no errors.
I have tried adding a default.htm file to the root of the app and loading the static page directly (using http://localhost/MyApp/default.htm). This gives 404. If I remove the web.config, this page will load.
I really didn't expect deploying the app to be this complicated.
Can anyone provide any guidance on how to troubleshoot or fix this problem?
Update 1: Web.config is below. I have tried with and without hostModel=... aspNetCore logs show successful startup. Nothing is added to the log with each page access attempt (seems weird)
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!--
Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
-->
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
<remove name="BlockViewHandler" />
<add name="JavaScript" path="*.js" verb="GET,HEAD" type="System.Web.StaticFileHandler" />
<add name="CSS" path="*.css" verb="GET,HEAD" type="System.Web.StaticFileHandler" />
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
</handlers>
<aspNetCore processPath=".\My.App.Name.exe" arguments="" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="OutOfProcess">
<environmentVariables />
<handlerSettings>
<handlerSetting name="debugLevel" value="file" />
<handlerSetting name="debugFile" value="d:\Log\MyApp.log" />
</handlerSettings>
</aspNetCore>
</system.webServer>
</configuration>
<!--ProjectGuid: ee76911e-decb-48b7-bd74-36ebfbdb22b6-->
Solved! I was making use of the ASPNETCORE_ENVIRONMENT environment variable, but was unaware that the publish process does not put this in web.config. I added this to Web.config:
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
</environmentVariables>
and the pages now load.
The most useful diagnostics I found were at this link Troubleshoot ASP.NET Core on IIS There they recommended that I run My.App.Name.exe from the command prompt. This creates a web process and assigns it to a port and gives you all the console output. This allowed me to figure out it was actually half working and that led me to the fact that I was missing the Env Variable.
Thanks again for the suggestions...

ASP.NET Core page not found when publishing to IIS

I updated my ASP.NET Core project from RC1 to 1.0 RTM (with preview2 tooling), everything went fine. I can debug in Visual Studio without problems. Next I would like to upload the site on a Windows Server 2008 R2 and IIS 7.5. I installed the necessary Windows Hosting tools and created the web application in the IIS. The problem is, that after I tried to open the page, it returned a 404 error. As I see in the task manager, my application is running, but stops in listening mode.
In the log file I only see these entries:
Hosting environment: Production
Content root path: C:\inetpub\wwwroot\MySite
Now listening on: http://localhost:20706
Application started. Press Ctrl+C to shut down.
It seems like there is some problem with the IIS integration. My web.config file looks like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="..\..\approot\MySite\MySite.exe" arguments="" forwardWindowsAuthToken="true" stdoutLogEnabled="true" />
<httpErrors errorMode="Detailed" />
</system.webServer>
</configuration>
I tried some workarounds from GitHub, which affected the Startup.cs file's Configure method without any success.
Any ideas?
FYI.. This web.config file was missing in the app folder.
This file should be at: C:\wwwwroot\myapp\
<?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=".\XXX.exe" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" />
</system.webServer>
</location>
</configuration>
Don't forget to replace XXX.exe with the correct name of your Web API exe name.
Ok, I had multiple problems, but the two main reasons why my site didn't work:
I cannot start the code from two separate places. I originally put the wwwroot content under the wwwroot folder (not so suprising), and the rest to the approot. Now everything should be in the same folder.
My release versions didn't want to work. I must use the contents of the debug folder. I don't know why.
And now, everything is ok.
please click on .cshtml file in Views folder and set build action=Content in right bottom panel in Visual Studio. My problem has been solved

Categories