JohnD91
JohnD91

Reputation: 583

Cant debug my .net 5 web api in visual studio 2019

My .Net 5 web application was not working in AWS when I had my project set up through visual studio. When we created a dotnet 5 project using the command line and copied the source code across, we managed to get the project working in AWS but I can no longer run my project and debug in visual studio 2019.

See below for the project structure: project structure

I have tried to open the project as a web site (File>Open>Web site..) so that a .sln is created. This asks me to create a web.config file to enable debugging...

enable-debugging

but if I accept this, I get a web.config file (which I thought wasn't even used in .net 5) which has an incorrect target framework in it (see below)

<?xml version="1.0"?>
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0"/>
  </system.web>
</configuration>

and when the app runs I get a 403 error:

403error

Things I've tried:

Upvotes: 0

Views: 1462

Answers (1)

samwu
samwu

Reputation: 5185

The error page shows that the cause of this error may be that the default document is not enabled, you can try follow these steps to resolve this problem:

1.Start IIS Manager. To do it, select Start, select Run, type inetmgr.exe, and then select OK.

2.In IIS Manager, expand server name, expand Web sites, and then select the website that you want to change.

3.In the Features view, double-click Default Document.

4.In the Actions pane, select Enable.

5.In the File Name box, type the name of the default document, and then select OK.

Upvotes: 1

Related Questions