Can't resolve "UnauthorizedAccessException" with MVC 2 application running under IIS7
        Posted  
        
            by Daniel Crenna
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Daniel Crenna
        
        
        
        Published on 2010-03-27T01:19:10Z
        Indexed on 
            2010/03/27
            1:23 UTC
        
        
        Read the original article
        Hit count: 520
        
aspnet-mvc
|iis7
We use MVC controllers that access System.File.IO in our application and they work fine in localhost (IIS 6.0-based Cassini). Deploying to IIS7, we have problems getting the controllers to work because they throw UnauthorizedAccessExceptions.
We have done the following to try to resolve the issue: - Set NETWORK SERVICE and IUSR accounts to have permission on the files and folders in question - Ensured the App Pool is running under NETWORK SERVICE and loading the user profile - Application is running under full trust - We tried adding impersonation to web.config and giving NETWORK SERVICE write permissions
Now, we alternate between getting UnauthorizedAccessException and an IIS7 404 page that suggests the routes are being ignored completely (for example we serve "/favicon.ico" via a controller when the physical file actually lives at /content/images/favicon.ico). We used ProcessMonitor to try to track down the issue but weren't successful.
© Stack Overflow or respective owner