0

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-->
0

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

5 Comments

When I download from the link you provided it downloads the hosting bundle for Core 2.2.1 but I'm trying to use 3.1 so I did some searching and found the hosting bundle for that. However, it's the same .exe that I already ran on my server. I then found an article that said to either reboot or run the "net stop was /y" and "net start w3svc". I ran those commands and they were successful. Check IIS again by clicking on Logging icon and I still get the same error as well as the same error when I run a GET command to the API.
I ran the command "dotnet --list-runtimes" and it returns Microsoft.AspNetCore.App 3.1.5 so it looks like Core is installed.
@Caverman, although the hosting bundle I linked is 2.2, it should solve your problem. It can be installed in parallel with the 3.1 hosting bundle, however, it's more important because it fixes the AspNetCoreModuleV2. Install it and let me know the result.
So, looked at the original file closer and the one installed was the SDK "dotnet-sdk-3.1.105-win-x64.exe" and not the hosting bundle that I downloaded " dotnet-hosting-3.1.5-win.exe". I ran the hosting bundle and I'm getting different questions than the SDK install and one is that I have to turn off Shared Configuration. Sure enough it's turned on and looks like it's sharing a file from another one of our servers. Waiting to talk with a network person to see if I can turn that off.
Looks like the Hosting bundle worked. I used the one for 3.1.5 instead of the 2.2 version. Thanks for the help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.