How to resolve Internal Server Error 500 on .Net Core 2.1.1 on IIS 8.5 - asp.net-core

I've read many similar issues but none of the resolutions solved my problem. So, here is my case.
I have a NET Core 2.1.1 app that runs beautifully within VS2017 and when published to my desktop running Win10 Pro and IIS10, i.e. running it outside of VS2017. But, when I deploy the app to a remote server Win2012 R2 with IIS8.5, I get the following issues with it.
I have followed different pages on deploying net core apps like this one.
https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/index?view=aspnetcore-2.1
When attempting to reach the site I get error 500 Internal Server Error.
IIS manager complains about the generated web.config when clicking on any of the site's settings e.g. Net authorization, Net Error pages etc...
Even when setting the stdoutLogEnabled to true, I don't get any log files. I even tried adding custom details flags in the web.config yet still nothing changed.
This is the generated web.config, and I hope someone points me in the right direction.
Thanks.
<?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=".\eSignWebMVC.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 72897161-bbbb-4f20-a12c-7f33922ea6bc-->

So I finally got this to work and I HAD to install the latest bundle v2.2.2 even though my app is targetting Net Core 2.1.1, but Microsoft's horrible technology still didn't make the app to run with the 2.1.1. bundle. Total waste of time and effort on such a stupid thing!!
What's the meaning of still providing the prior bundles if none of them does anything?

Related

How to fix HTTP Error 500.31 - Failed to load ASP.NET Core runtime

I'm trying to publish .NET core 5.0 application to IIS but always having errors!
I already tried every single response on StackOverflow and no one works for me .
The last error :
HTTP Error 500.31 - Failed to load ASP.NET Core runtime
Common solutions to this issue:
The specified version of Microsoft.NetCore.App or Microsoft.AspNetCore.App was not found.
Troubleshooting steps:
Check the system event log for error messages
Enable logging the application process' stdout messages
Attach a debugger to the application process and inspect
For more guidance on diagnosing and handling these errors, visit Troubleshoot ASP.NET Core on Azure App Service and IIS.
My web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\AppCore.dll" stdoutLogEnabled="false" hostingModel="inprocess" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
</system.webServer>
</configuration>
dotnet --info
There could be any number of errors during start up that is causing your problem. When I first faced this issue, enabling logging and viewing that put me in the right direction.
Enable logging by editing your deployed web.config file.
<aspNetCore processPath="dotnet"
arguments=".\AppCore.dll"
stdoutLogEnabled="true" *** <<< change this
hostingModel="inprocess"
stdoutLogFile=".\logs\stdout"
forwardWindowsAuthToken="false"/>
Then ...
Recycle your server application
Make a request to your server application
This should cause the previous error
Have a look on your server for log file in logs\stdout*
The log file should give you some pointers
If this doesn't nail it first time, you might need to add some extra logging on the server based on the pointer from step 5.

Deploy ASP.NET Core Web API on IIS 10 [duplicate]

I developed a web api in asp.net core version 1.0.1 using visual studio 2015, when I published the web api in IIS 10 of the same pc where it was developed, everything works correctly. The problem arises when I copy and paste the publication folder of the web api to a different pc, the browser shows the error 500.19 Internal Server Error, error code 0x8007000d, "The requested page can not be accessed because the related configuration data for the page is invalid ", which leads to some problem in the web.config.
I do not think the version of IIS is the problem because moving from IIS 10 to IIS 8 or from IIS8 to IIS 10 gives the same error, and the same happens between two pcs with IIS 10.
I have already reviewed several related issues, like, The element 'system.webServer' has invalid child element 'aspNetCore', and others related to web.config file where it seems the error is found. The web.config file in the development environment is:
<?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="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
</system.webServer>
</configuration>
After publish the web api, the web.config file looks like:
<?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="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\buildingSecureWebApi.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />
</system.webServer>
</configuration>
This web.config file has the same content no matter what computer was publish.
Some idea of ​​what the solution to my problem may be, I need to mount the web api in any version of windows and until now it only works correctly on the pc that was developed.
To get a more detailed error message:
Verify that the log directory exists at the path referenced by the web config. If it does not, create it. The path shown in your config would place the "logs" directory in the root folder of the deployed site.
Verify that the application pool has write access to the logs directory and
Verify that `stdoutLogEnabled="true".
If you have verified all 3 of these items, then you should get log entries that will contain a more detailed description of the error
What could cause a "500.19 Internal Server Error, error code 0x8007000d" error?
.NET Core hosting bundle is not installed on the webserver where the site is deployed. To remedy this, obtain this download .NET Core Windows Server Hosting bundle
You may also want to verify that the path to the dotnet executable exists in the deployment machine's environment variables. To check this, first find the path where dotnet.exe is installed. It is generally located in either C:\Program Files\dotnet or C:\Program Files (x86)\dotnet. Once you know the path, ensure that the path exists in your Environment Variables.
Control Panel > System > Advanced System Settings > Environment Variables. highlight "Path", click 'Edit' and verify that the path to the dotnet folder is present. If it isn't, add it. Do the same for both the User variables and System variables. Restart your machine and try again.

Why do I get a 500.19 Internal Server Error when publishing to IIS? [duplicate]

This question already has an answer here:
asp.net core web api published in IIS after moved to different IIS server pc gives error 500.19 (0x8007000d)
(1 answer)
Closed 2 years ago.
Here is the contents of my web.config file which was generated automatically:
<?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=".\RRRRAdminFrontend.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 2b13cd10-9360-4795-8443-00aebad0bb00-->
Error Message
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Detailed Error Information:
Module
IIS Web Core
Notification
Unknown
Handler
Not yet determined
Error Code
0x8007000d
Config Error
Config File
\\?\C:\inetpub\RRRRAdmin\web.config
Requested URL
http://rrrradmin.sharevista.com:80/
Physical Path
Logon Method
Not yet determined
Logon User
Not yet determined
Config Source:
-1:
0:
Does anyone know where I'm going wrong or if I need to change anything with this? I'm not too familiar with working with IIS so I can show other code snippets if it would help.
If you want to host Asp.net core application on IIS, you need to install the ASP.NET Core Module/Hosting Bundle.
Download the installer using the following link:
Current .NET Core Hosting Bundle installer (direct download).
For more details instructions on how to install the ASP.NET Core Module, or installing different versions, see Install the .NET Core Hosting Bundle.

IIS cannot open web.config - The requested page cannot be accessed because the related configuration data for the page is invalid

I'm trying to deploy new asp.net core 5 (5.0.100-rc.1.20452.10) app to IIS on Win 10 and Windows Server 2019.
I've deployed the app using Visual Studio to Default Web Site with ApplicationPoolIdentity and granted full access permission to both "IIS_IUSRS" and "Everyone".
I'm still getting:
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
When I try to open the config in IIS Manager I get "Data is invalid" error:
The webconfig looks pretty normal:
<?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=".\MyApp.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
I think I've installed all IIS Features:
I had the same issue, while deploying net core 6 application.
I gave the IUSR and IIS_IUSR permissions.
I installed the URL rewrite extension.
The thing finally saved me was I checked for if net core hosting was installed on my system, we can verify in system registry under:
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Updates.NET Core path
like screenshot below.
And I fixed it after downloading the hosting module:
.Net hosting bundle
And now the settings and application works fine.

500 error : Unable to get required configuration section 'system.webServer/aspNetCore'

I have an internal server error at my .NET Core web service launch. Tuesday morning, the web-service was lauching well, Tuesday afternoon a windows update has been installed (KB4570720 package), Wednesday I have this 500 error...
The IIS error page tell me :
Module AspNetCoreModuleV2
Notification ExecuteRequestHandler
Gestionnaire aspNetCore
Code d'erreur 0x80004005
And IIS log event has this specific error :
Could not load configuration. Exception message: Unable to get required configuration section 'system.webServer/aspNetCore'. Possible reason is web.config authoring error.
This my web.config, I don't see what's wrong.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<remove name="aspNetCore" />
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\loemail.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess">
<environmentvariables />
</aspNetCore>
<httpErrors errorMode="Detailed" />
</system.webServer>
</configuration>
I have tried to change the encoding from UTF8 to ANSI.
I've tried to change the stdoutLogEnabled from false to true but there is no error there since it occurs before.
I've tried to remove completely the web.config and copy-paste the one from my backup.
I've tried to reinstall the web-service.
I have another .NET Core application running on this server, so I excluded issues with the .NET framework version but maybe I'm wrong? How could I check that? Both use .NET Framework 2.2.
Should I remove the last windows update package?
I fix the problem by copy/paste the web.config from my other application... And I still see no difference between them ! Computer makes us crazy sometimes...