Caverman
Caverman

Reputation: 3707

Issue with web.config in Web API

I'm working on my first real world .Net Core 3.1 Web API and I'm getting an error with the web.config file but don't know what's wrong.

I create the Web API locally and it tests out just fine. I published the project to a local folder and then copied it out to IIS on our STAGE server. When I open IIS and click on any of the icons for the project (in this case I clicked the Logging icon) and I get an error "There was an error while performing this operation" and the file name points to the web.config in my folder structure.

enter image description here

The web.config file is created automatically when I publish the project. Anyone see what the issue could be with the web.config that's causing the problem?

<?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=".\AvTechAPI.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
    </system.webServer>
  </location>
</configuration>
<!--ProjectGuid: 24142d05-13a1-4655-b2b8-8f8456003615-->

Upvotes: 0

Views: 1921

Answers (1)

Shadi Alnamrouti
Shadi Alnamrouti

Reputation: 13248

Windows IIS

Solution: Install the hosting bundle.

Reason: Although the SDK normally contains the runtime, however, it seems the SDK installer is not registering the runtime correctly on the server.

Workaround (not recommended):

Change AspNetCoreModuleV2 to AspNetCoreModule inside web.config.

Azure platform hosting

Install the .NET Core runtime extension by selecting Extensions and then installing .NET Core Runtime.

Upvotes: 2

Related Questions