Monday, December 10, 2012

How To: Stop "Access Denied" errors in MVC Intranet Applications VS 2012/IIS Express [Field Notes]

Problem
  • Using Visual 2012 and IIS Express
  • Building an MVC4 Intranet project
  • Authentication Doesn't appear to work; I always get an "Access Denied" screen on every page.

Cause

This happens because IIS Express isn't configured by default for Windows Authentication.


Solution
  • Run your project.
  • While it is running / showing you the error, find the IIS Express Icon in your system tray
  • Right-click the icon and select "Show all Web Applications".
  • Click on your web application.
  • Look at the "Config" property to find where your applicationhost.config file is stored.
  • Stop your web site and open that applicationhost.config file for editing.
  • Find the section where WindowsAuthentication enabled is set to "false" and change it to "true". Save the file.

References

2 comments:

  1. Thanks for the quick and easy access to the IIS express config!

    ReplyDelete
    Replies
    1. Glad to hear you found this useful!

      Delete

Keep it classy, folks.