Search code examples
azureasp.net-corevirtual-directoryazureportal

Azure: App Service: Deploy Virtual Directory


I have an asp.net core app deployed on azure website and the domain is www.somewebsite.org. My web.config file is under site\wwwroot\web.config. Its contents are

<configuration>
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="dotnet" arguments=".\App1.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout">
            <environmentVariables>
            </environmentVariables>
        </aspNetCore>
  </system.webServer>
</configuration>

I am trying to deploy another asp.net core app with the virtual path www.somewebsite.org/kiosk and I copied the complete directory under site\wwwroot\kiosk and the web.config file is under site\wwwroot\kiosk\web.config. Its contents are:

<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>            
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />      
    </handlers>
      <aspNetCore processPath="dotnet" arguments=".\Kiosk.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" />
    </system.webServer>
  </location>
</configuration>

On Azure portal, in Application Settings for my site, I have / - site\wwwroot /kiosk - site\wwwroot\kiosk

When I try going to www.somewebsite.org, the app1 site is loaded whis is correct. But, when I go to www.somewebsite.org/kiosk, the kiosk app is not being loaded. The page comes back with a 500 Internal Server Error. How do I fix this error? Is it even possible to host multiple apps from separate multiple virtual paths under one website in azure?


Solution

  • In my sub-application web.config file, I did the following and it started working:

    <configuration>
        <system.webServer>
          <handlers>            
            <add name="aspNetCore_TEMP" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />      
        </handlers>
          <aspNetCore processPath="dotnet" arguments=".\Kiosk.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" />
        </system.webServer>
    
    </configuration>
    

    Now, both the sites are up.

    Thanks for your help.

    NH