Search code examples
.net.net-coreweb-configweb.config-transform

Configure web.config dotnet IIS


I'm developing a dotnet application followed the passage of the reference and locally on Ubuntu it's all ok, however now I try to publish to my windows server and when access to route configurable them myself from the following error:enter image description here

In the reference he will tell me to delete the malformed element in my web.config, but I do not know what I'm doing wrong, can someone help me?

<?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=".\connect-app.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" hostingModel="inprocess" />
  </system.webServer>
</configuration>

Solution

  • There are multiple ways that you could end up in this error.

    • The ASP.NET Core Module v2 was not properly installed and configured.

      • Install the ASP.NET Core Hosting Bundle from here
    • Verify that the AspNetCoreModuleV2 in the IIS Modules
    • Sometimes, the file system may restricts the access to some paths for the Application Pool

      • Try adding the Application Pool Identity to the respective File/Folder

        ICACLS C:\StatusApp\ /grant "IIS AppPool\YourAppPool:F"

    • Put your Hosting as "Out of Process" and see if the .NET Core Apllication is properly instantiated.