I'm getting infamous
HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid
error:
while trying to access swagger definition of a .NET 6 Web API web service (http://localhost:4357/swagger/index.html). It's running OK on my development PC and on another production PC/VPS but doesn't run on my customer's main system, which is Win10 Prof with .NET6 SDK installed
and all IIS 10's Windows Web Features installed (except "Health and Diagnostics", all or some of which can't be installed on the target customer Win10 Prof system. I have tried to installed them - it failed.)
The issue seems to be somehow related to the Web.config file, which is reported as unavailable(?) - I have checked many times - it's there and the Web API Web service is properly set.
The web.config file of the .NET 6 Web API Service has the following contents:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<modules>
<remove name="WebDAVModule" />
</modules>
<handlers>
<remove name="WebDAV" />
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\LocationManagerWebAPI.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 8E5AB294-C158-4FB6-8642-EA002FCC6E60-->
So the issue should be something related to the fact that IIS doesn't have proper access rights to the Web API folder as it "doesn't see" the web.config file? (But I have set the Application Pool identity to LocalSystem) or ... ?
If (some of) "Health and Diagnostics" features can't be installed (the system reverts on initial state on reboot after trying to setup "Health and Diagnostics" WWW Services features) then there should be some special security access policy set, which doesn't allow the logged-in user (which has Administrative privileges) to activate some Windows features?
I'm not the system engineer who installed the host Win 10 Prof System. The customer informed me it was another company. Should we contact them to solve the issue or there exist a "quick-fix" solution for this issue? After all "Health and Diagnostics" WWW services features aren't necessary and all the other WWW Services features seems to be up and running. (Simple .html page is served well from a test html-only web site))
What else should I check on the host system? When trying to activate Configuration Editor for the subject .NET 6 Web API Web Site/Service I'm getting the following error message:
[UPDATE]
When running the subject .NET 6 Web API as a self-hosting app/Web API (by activating its .exe) it runs well under default TCP port/URL http://localhost:5000.
[UPDATE 2]
machine.config and the root web.config in
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config
and ApplicationHost.config in
C:\Windows\System32\inetsrv\config
seems to be correct. Could it be these global settings files have "Health and Diagnostics" settings written to but the corresponding .DLLs not installed? - because the target system doesn't allow to install these DLLs?
But I the activated "Run Windows Features on and off" and set just "HTTP Logging" for WWW Services. And then iisreset. And this setup worked. HTTP requests are now logged in C:\inetpub\logs\LogFiles\W3SVC5. Still .NET 6 Web API responds with HTTP Error 500.19.
Should I completely remove IIS and WWW Services via "Turn Windows Features On and off" , reboot and then reinstall IIS and WWW Services? Will that fix the global ASP.NET (Core) settings files?
[Update 3]
I have just checked C:\Windows\System32\inetsrv\config\applicationHost.config on a properly working Web API system box and I have found that at least the following entries are missing in the corresponding file on the target failed system box:
<globalModules>
...
<add name="AspNetCoreModule" image="%SystemRoot%\system32\inetsrv\aspnetcore.dll" />
...
<add name="AspNetCoreModuleV2" image="%ProgramFiles%\IIS\Asp.Net Core Module\V2\aspnetcorev2.dll" />
...
<system.webServer>
<modules>
...
<add name="AspNetCoreModule" />
...
<add name="AspNetCoreModuleV2" />
...
as well as the
- %SystemRoot%\system32\inetsrv\aspnetcore.dll and
- %ProgramFiles%\IIS\Asp.Net Core Module\V2\aspnetcorev2.dll
files.
I then repaired ASPNET Core runtime setup. It worked seamlessly. Then I have rebooted the system - still the entries and files are missing.



