Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Asp.Net is looking for the web.config in the wrong place

I've got a strange issue - Up until now I've only worked on this application on a single machine. I've downloaded an asp.net web app onto a dev machine in a clients office.

When I try to run the application in debug mode through Visual Studio I get 500.19 error - typically this means a permission problem. I went through the motions of checking the permissions before I noticed the directory it was looking for the config file in.

The 'Config File' shown on the error is

\\?\C:\Users\{my-name}\Documents\{project-name}\web.config
  • however the correct location is actually

    C:\Users\admin\Documents\projects\{project-name}\web.config

Does anyone know where the location of the web config is specified? I had always assumed it could only ever be in the root directory.

like image 651
Brett Avatar asked Sep 12 '15 02:09

Brett


2 Answers

As it turns out the cause of this was upgrading to Visual Studio 2015.

Rather than a .suo file the new Visual Studio has a .vs folder with files specific to an instance of a project. The root directory of the development site is included in here.

I deleted the files and added .vs/* to my .gitignore file and had no more problems.

like image 121
Brett Avatar answered Nov 15 '22 06:11

Brett


At our infrastructure it turned out that inside the web.config withing the node <system.webServer>, we had a nested node named <rewrite />. That one wasn't recognised by IIS.

By either removing that node or installing the missing feature (url-rewrite), the application started as expected.

like image 39
Peter Avatar answered Nov 15 '22 08:11

Peter