9

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.

4
  • Do you actually mean projects\{project-name}\web.config instead of projects{project-name}\web.config?
    – Dai
    Sep 12, 2015 at 2:25
  • Yes, that's one of the things that I thought was strangest about what's happening. I wen't looking through the .sln expecting to see an absolute path where a relative path should be, but can't see anything.
    – Brett
    Sep 12, 2015 at 2:35
  • Your SLN file has nothing to do with this... unless this is a project-less Website Project rather than a Web Application Project?
    – Dai
    Sep 12, 2015 at 2:36
  • It's an old website project that's JIT compiled. It has an sln, but no vcproj file.
    – Brett
    Sep 12, 2015 at 2:47

4 Answers 4

10

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.

2

In my case, the top level website in IIS had a physical path of:

C:\Users\MyUserName\Documents\My Web Sites

For some reason, this meant IIS refused to look anywhere else, even though my projects underneath had been converted to applications.

Fix for me:

  1. Go to IIS
  2. Right click on the top level website (i.e. 'Default Web Site', or the problematic website at the same level)
  3. Select 'Manage Website > Advanced Settings'
  4. Change the physical path to C:\inetpub\wwwroot
  5. Save and reload website

I could then have any path for my applications and IIS could work it out as expected.

2

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.

0

Assuming you mean Documents\projects\{project-name}\web.config instead of Documents\projects{project-name}\web.config you're seeing the effect of Application Scopes.

In IIS, multiple entirely separate web-applications can be part of the same website by being split-up into "Application Scopes" - which usually works by specifying a prefix path followed by the Scope root (prior to IIS7 an Application Scope could be a physical or virtual directory, since IIS7 they're always virtual directories, but can still represent a physical directory).

Open IIS Manager and select the (virtual )directory that Visual Studio created for your project and right-click it in the left-side Navigation pane and choose "Convert to Application", then ASP.NET will look for the web.config file (and the bin directory, amongst others) in this folder only, rather than the website root.

Note that the website root is also considered an application scope root, hence the common error message "Exception in "/" application". If you get a YSoD in another application root you'll see "Exception in "/subFolder" application" messages.

1
  • Good spotting with the missing backslash - I didn't realize StackOverflow had escape characters. Your idea makes sense, but this is running (or at least trying to run) in IIS Express through Visual Studio. Could the equivalent be happening through that setup somehow?
    – Brett
    Sep 12, 2015 at 2:46

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.