I have created an ASP.NET MVC 3 project, and am using IIS Express as the web server when developing. When I try to debug, I get the error message below.
How can this be solved?
Server Error in '/' Application.
Access is denied. Description: An error occurred while accessing the resources required to serve this request. The server may not be configured for access to the requested URL.
Error message 401.2.: Unauthorized: Logon failed due to server configuration. Verify that you have permission to view this directory or page based on the credentials you supplied and the authentication methods enabled on the Web server. Contact the Web server's administrator for additional assistance.
I had to run Visual Studio in
Administrative Mode
to get rid of this error.The cause if had for this problem was IIS Express not allowing WindowsAuthentication. This can be enabled by setting
in the applicationhost.config file located at C:\Users[username]\Documents\IISExpress\config.
I opened my web.config file, and found and removed this section:
and my site came up, but there are issuues with the authentication..
None of the above had worked for me. This had been working for me prior to today. I then realized I had been working with creating a hosted connection on my laptop and had Shared an internet connection with my Wireless Network Connection.
To fix my issue:
Go to Control Panel > Network and Internet > Network Connections
Right click on any secondary Wireless Network Connection you may have (mine was named Wireless Network Connection 2) and click 'Properties'.
Go to the 'Sharing' tab at the top.
Uncheck the box that states 'Allow other network users to connect through this computer's Internet connection'.
Hit OK > then Apply.
Hope this helps!
I didn't see this "complete" answer anywhere; I just saw the one about changing port numbers after I posted this, so meh.
Make sure that in your project properties in visual studio that project url is not assigned to the same url or port that is being used in IIS for any site bindings.
I'm looking up the "why" for this, but my assumption off the top of my head is that both IIS and Visual Studio's IIS express use the same directory when creating virtual directories and Visual Studio can only create new virtual directories and cannot modify any that IIS has created when it applies it's bindings to the site.
feel free to correct me on the why.
I had also the same problem and finally I could overcame it.
Solution Explorer
→Right click on project
→Properties
→Web tab
→Project Url
I have chosen another port number, and every things became fine!