dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.5k stars 10.04k forks source link

applicationInitialization on Azure Webapp does not work with OutOfProcess - 502.3 The request is not supported. #51823

Open SanderMeesterIndepender opened 1 year ago

SanderMeesterIndepender commented 1 year ago

Is there an existing issue for this?

Describe the bug

I have a .net 6 application exposing a url at "/health" with a web.config like this:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <applicationInitialization doAppInitAfterRestart="true">  
        <add initializationPage="/health" hostName="myexamplewebapp.azurewebsites.net"/>        
      </applicationInitialization>

      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath="dotnet" arguments=".\myexamplewebapp.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="OutOfProcess" />
    </system.webServer>
  </location>
</configuration>

When I hit the '/health' url I get two traces; the first by the applicationInitialization and the second because of my request.

The first fails: MODULE_SET_RESPONSE_ERROR_STATUS:

ModuleName="AspNetCoreModuleV2", Notification="EXECUTE_REQUEST_HANDLER", HttpStatus="502", HttpReason="Bad Gateway", HttpSubStatus="3", ErrorCode="The request is not supported.
 (0x80070032)", ConfigExceptionInfo=""

SET_RESPONSE_ERROR_DESCRIPTION ErrorDescription="There was a connection error while trying to route the request."

The second succeeds without issues.

When I change the hostingModel from OutOfProcess to InProcess the applicationInitialization works fine.

According to the documentation, you'd expect that OutOfProcess is supported: "Applies to apps hosted in-process and out-of-process."

Is there anything I can do to resolve this? Changing to InProcess is not an option for me as I have multiple netcore subapplications.

I've attached the traces for both InProcess and OutOfProcess.

Expected Behavior

applicationInitialization to be able to request urls served by an out OutOfProcess netcore process

Steps To Reproduce

No response

Exceptions (if any)

MODULE_SET_RESPONSE_ERROR_STATUS:

ModuleName="AspNetCoreModuleV2", Notification="EXECUTE_REQUEST_HANDLER", HttpStatus="502", HttpReason="Bad Gateway", HttpSubStatus="3", ErrorCode="The request is not supported.
 (0x80070032)", ConfigExceptionInfo=""

SET_RESPONSE_ERROR_DESCRIPTION ErrorDescription="There was a connection error while trying to route the request."

.NET Version

6

Anything else?

inprocess_applicationInitialization_succeeding.xml.txt inprocess_requested_succeeding.xml.txt outofprocess_applicationInitialization_failing.xml.txt outofprocess_requested_succeeding.xml.txt

SanderMeesterIndepender commented 9 months ago

/azp run