Trying to host static site through visual code, but getting error after build


So I am learning C# and I am trying to deploy a simple static website and I am getting the following error message:

HTTP Error 404.0 - Not Found The resource you are looking for has been removed, had its name changed, or is temporarily unavailable. Most likely causes: The directory or file specified does not exist on the Web server. The URL contains a typographical error. A custom filter or module, such as URLScan, restricts access to the file.

Does anyone know what it could potentially be?

I went back and looked at the possible causes and everything is fine, atleast I think.

This is how I added the website.

enter image description here

I mapped the domain name,, with the local server like this. I then put the modified file back as an administrator in C:\Windows\system32\drivers\etc enter image description here

This is how i have my IISsetup. enter image description here

> > Detailed Error Information:
Module IIS Web Core
Notification MapRequestHandler
Handler StaticFile Error Code 0x80070002 Requested URL
Physical Path C:\Users\User Name\source\repos\webapi\api\user
Logon Method Anonymous Logon User Anonymous

More Information: This error means that the file or directory does not exist on the server. Create the file or directory and try the request again.

asked on Stack Overflow Sep 23, 2019 by csb00 • edited Sep 23, 2019 by csb00

2 Answers


Hi did you notice that Staticfilehandler is handling the request instead of extensionless handler?

So please ensure your feature has been installed correctly. Then you should see several extensionless handlers displayed in IIS handler mapping. So that extensionlessUrlhandler would process the route instead of accessing the physical path.

Besides, please ensure you have published the project correctly and IIS is using integrated mode.

Finally, remember to promise your IUSER and application pool identity have enough permission to access the root folder. I think host website in desktop is not a good idea.

answered on Stack Overflow Sep 24, 2019 by Jokies Ding

I ended up transferring my project to the desktop and it worked.

answered on Stack Overflow Sep 23, 2019 by csb00

User contributions licensed under CC BY-SA 3.0