2

I am deployinng a .Net app through IIS running on Windows 10. Web.config is processed properly and IIS does not report any issue with it. However the aspnetcore module is not started and I cannot browse through the site. If I run dotnet dllname from the command line then my site works properly. This has been a frustrating endeavor. THe IIS logs don' t provide any clue as to why IIS cannot start the site as dotnet does from the command line. Trying to enable aspnetcore enhanced tracing does not do anything. Here is my web.config:

<configuration>
 <location path="." inheritInChildApplications="false">
   <system.webServer>
     <handlers>
       <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
     </handlers>
     <aspNetCore processPath="c:\Program Files\dotnet\dotnet.exe" arguments="c:\escompdata2\ESTemplateCompData.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" >
       <handlerSettings>
         <handlerSetting name="debugFile" value=".\logs\aspnetcore-debug.log" />
         <handlerSetting name="debugLevel" value="FILE,TRACE" />
      </handlerSettings>
     </aspNetCore>
   </system.webServer>
 </location>
   <system.webServer>
       <rewrite>
           <rules>
               <rule name="ReverseProxyInboundRule1" stopProcessing="true">
                   <match url="(.*)" />
                   <action type="Rewrite" url="http://escompdata:5000/{R:1}" />
               </rule>
           </rules>
       </rewrite>
   </system.webServer>
</configuration>

My app pool does have the proper permission. I am using the admin ID with the proper credential. Here is a screenshot of the app pool basic settings enter image description here

Here is a screenshot of the advanced settings enter image description here I am setting a reverse proxy for my site and when the dotnet app is launched from the command line, IIS is hitting it fine which seems to indicate that the site is at least set up properly in IIS.

The problem is that IIS does not seem to be able to launch the app neither via dotnet nor with the app executable. I have not tried the out or process mode with the Kestrel server but this is a puzzling piece. IIS does not seem able to yield any clue via the logs. Any help would be tremendously appreciated.

7
  • Run a report to reveal more information, docs.jexusmanager.com/tutorials/ancm-diagnostics.html Commented Dec 19, 2020 at 14:32
  • How do you confirm that the aspnetcore module cannot be started? Is there any error messages in the browser or iis? Commented Dec 21, 2020 at 8:52
  • I updated web.config, I setup proxy info via IIS restart the server and browsed to the site I get error 502.3 Bad Gateway Commented Dec 21, 2020 at 15:34
  • I have definitely verified that IIS is not starting the module using dotnet. First when I list all the processes running on the machine, dotnet is not included as it is when I run dotnet from the command line with the project dll. Second, the app is should be listening to localhost:5000. When I browse to that link it fails which verifies nobody is listening there. This should be a simple problem. Unfortunately I am at lost find out what is the root cause. Commented Dec 22, 2020 at 17:12
  • The first thing you have to do is to confirm what caused this error, you can try the methods I mentioned below. Commented Dec 23, 2020 at 7:12

3 Answers 3

1

IIS requires the appropriate Hosting bundle to be installed in order to host your .Net Core app. For example if you have a .Net Core 3.1 app you'll need to install the .Net Core 3.1 hosting bundle. IIS does not support executing .Net Core apps out of the box. This reference should get you started.

Host ASP.NET Core on Windows with IIS.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks @FrankJames. I did install the hosting bundle right off the bat. It should be a no brainer, you tell IIS the executable and it spawns it. I have the same problem when hosting a NodeJS app and using the iisnode module. I am doing something that prevents IIS from starting the appropriate module but can' t figure out what it is. As with dotnet I can start node from the command line and the IIS proxy forwards the request to the server with no problems.
0

There are many reasons for the 502.3 Bad Gateway error. The first thing you need to do is to determine what caused the error.

This link provide the steps to troubleshooting the 502.3 error: Troubleshooting 502 Errors in ARR.

Comments

0

I called Microsoft and they walked me through what was going on. I was telling IIS to proxy to localhost:5000 which is what the app listens to when started with the dotnet command at the command line. However when IIS starts the app it does not use that port. The key was to tell IIS to bind the app to port 80 unlike the 5000 I was telling it and in the URL rewrite portion to set the action to None. That allowed me to browse to the app.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.