What I want to achieve is simple:
- I have a website, say “my-site” – http://localhost
- In this website I have a (physical) folder “foo” – http://localhost/foo
- Inside the “foo”-folder I want to have a virtual directory (application?) called “upload”, so the URL becomes http://localhost/foo/upload
Notice that “my-site” is an empty website with a bunch of folders in it, “foo”, “bar”, “baz”, etc.
So when I right click on “foo” and choose “New > virtual directory” and add my application I’ve written in VS.NET and then try to navigate to http://localhost/foo/upload I get this error:
Parser Error Message: An error occurred loading a configuration file: Failed to start monitoring changes to 'C:InetPubmy-sitefooweb.config' because access is denied.
The thing is, there is no web config. in the “foo”-folder, and it shouldn’t since it’s only a normal folder in the site. If I add the virtual directory at the top level, at say http://localhost/foo_upload, everything works as it should… so, what am I doing wrong here?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
It sounds like a permissions problem with your system – for a .NET account the user context ASP.NET runs in requires access to your site.
On systems up to Windows Server 2000 this user was a local account simply called ASPNET, after that is changed to one of the NT_AUTHORITY accounts – the easiest way to find this is to provide the IIS WPG group (a local group) with access to the account.
MS provides instructions at http://support.microsoft.com/kb/316721/, use the above to determine which user account you should check access for.
Method 2
I’m just answering for someone who has the same problem and found this topic.
I added a permission to Everyone (in this case, it would be in the folder C:InetPubmy-sitefoo). Then I printed on the page what user is executing the app in this folder…
Something like:
labelCurrentUser.Text = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
Then I removed the permission to everyone and added the user that I got.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0