0

I am deploying 2 different projects in an azure web app service. The service is configured to be running dotnet 5. I am using virtual directory to deploy 3 applications in this app service. The default app, a dotnet 5 app, runs fine. On the first subsites if I deploy a dotnet 2.1 app, that works perfectly. But when I try to deploy a dotnet 5 app on the second subsite it shows the mentioned error in question - added an image of it enter image description here

As far as I understood this is probably happening because they share same application pool. I tried the following stuffs:

  • Deployed as a self-contained app
  • Added AspNetCoreModuleV2 and out of process tags in csproj files of all projects as per this answer (and a few more answers from that link)

Frankly speaking I couldnt find much help in the net and not really sure how to proceed with this.

Rafat Rashid
  • 85
  • 2
  • 8

1 Answers1

0

Please try to follow this order

Step 1 -

  • Close your solution
  • Delete applicationhost.config in folder .vs or delete the whole .vs folder ( this will clear all the cache - old dlls). .vs folder is a hidden folder
  • Restart your solution again

Step 2 -

Change your web application as well as any other virtual application deployed from "InProcess" hosting model to "OutOfProcess".Add the following value to each project file (.csproj):

<PropertyGroup>
  <AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
</PropertyGroup>

After deploying your application in azure verify that few changes has taken place in web.config file which looks like below

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath="dotnet"
                  arguments=".\MyApp.dll"
                  stdoutLogEnabled="false"
                  stdoutLogFile=".\logs\stdout"
                  hostingModel="OutProcess" />
    </system.webServer>
  </location>
</configuration>

For reference please follow the MS Document

  • I did delete the .vs. And also tried outOfProcess. And I dont have a web.config, deploying in azure. Or rather I dont know where is the webconfig in azure if there is any. Can you point me where to find that if possible? – Rafat Rashid Sep 16 '21 at 10:45
  • In the Azure Portal, navigate to the web app. In the App Service blade, enter kudu in the search box. Select Advanced Tools > Go. Select Debug console > CMD. Navigate to site/wwwroot Select the pencil icon to edit the web.config file. – HarshithaVeeramalla-MT Sep 16 '21 at 11:06