0

I have 2 separate projects developed in .NET6. One is a web app (developed using Razor pages) and the other is WebAPI (Minimal). I would like to publish them under the same URL i.e. mywebsite.com. The WebAPI would have the URL as mywebsite.com/api. I published the web app and then created a Virtual Directory in IIS with Alias as api under the web app. Both the projects have their own web.config files and appsettings.json files in the root folders. When I try to access the WebAPI I get the HTTP 503 error. Earlier only WebAPI project was published in the IIS and was working fine.

Some thoughts: the HTTP Handlers (end points) in the WebAPI are like this: app.MapGet("/api", () => "Welcome"); Is the path correct under new deployment structure? The web.config has the AspNetCore module as - <aspNetCore processPath=".\WebAPI.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" /> Should it have .\api\WebAPI.exe as the path?

Any pointers please? Please let me know if any more info is needed.

NP3
  • 652
  • 8
  • 21

1 Answers1

0

This got resolved using This answer on SO

Summary: Instead of adding the WebAPI as a virtual directory add it as a child Application in a subfolder of the Web App. The path including the subfolder becomes the root of the WebAPI. You may have to adjust the paths either in the WebAPI or in the clients to reflect this.

NP3
  • 652
  • 8
  • 21