This is my web.config
file (ASP.NET Core 7.0) :
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".Test.dll" stdoutLogEnabled="false" stdoutLogFile=".logsstdout" />
<defaultDocument>
<files>
<clear />
<add value="index.html" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
In this case I get a 404 error. But when I send request with Postman, I get the response.
If I remove this config:
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
Index.html
page entered as the website default page. But in this case when I send request with Postman, I can’t get a response.
How can I fix this?
1
Answers
If you want to add a default html page, you should put it inside the asp.net core wwwroot folder and enable the static file middleware inside the program.cs.
Like below:
Program.cs