Dave New
Dave New

Reputation: 40092

dotnet publish and web.config?

How I understand it is that web.config is required when running an ASP.NET Core web application on Azure App Service:

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

dotnet publish -c Release doesn't create this web.config, so I created itself and put it in the solution (odd, because I've never had to do this before).

But the issue I am experiencing is that it does not publish the web.config file? It seems to ignores it.

The only way I can get my application working in the Web App is to manually copy the web.config file into the wwwroot folder using Kudu.

Note: This is a framework-dependent deployment (FDD), not self-contained, and using .NET Core 2.

Upvotes: 9

Views: 5382

Answers (1)

Dave New
Dave New

Reputation: 40092

We finally figured it out. The project type was incorrect. It needs to be:

<Project Sdk="Microsoft.NET.Sdk.Web">

And not

<Project Sdk="Microsoft.NET.Sdk">

Upvotes: 12

Related Questions