IIS application publishing problem

Status
Not open for further replies.

StarKruzr

Ars Tribunus Angusticlavius
7,165
Subscriptor
We're trying to deploy an application, just locally to a machine running IIS 7.5. Despite having given IUSR, Network Service, DefaultAppPool and ASP.NET 4.0 full control on the folder containing the code, we keep getting told this:

Code:
Server Error in '/' Application.
--------------------------------------------------------------------------------


Access to the path 'C:\TestRelease' is denied. 
  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

 Exception Details: System.UnauthorizedAccessException: Access to the path 'C:\TestRelease' is denied. 

ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and the configured application pool identity on IIS 7.5) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user. 

To grant ASP.NET access to a file, right-click the file in File Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

Source Error: 


 An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 



[UnauthorizedAccessException: Access to the path 'C:\TestRelease' is denied.]
   System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +216
   System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) +1430
   System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) +211
   System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost) +187
   System.IO.File.InternalReadAllText(String path, Encoding encoding, Boolean checkHost) +90
   ISTools.Common.ActiveDirectory.UserProperties.FillUserSessionByJson(String roleDefinitionJsonFile, String loginName) +105
   DBManagement.SessionedPage.OnPreInit(EventArgs e) +117
   System.Web.UI.Page.PerformPreInit() +49
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1844

  


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34249

We're not using identity impersonation. Any idea what's going on here? I feel like it's something dumb we've been staring at for an hour and can't see.
 

Dilbert

Ars Legatus Legionis
34,009
[url=http:/civis/viewtopic.php?p=28975545#p28975545:3qpliwx6 said:
flyingember[/url]":3qpliwx6]Is the app pool running as an account that can write to either location? you can set it to run as a local or domain user
This! The application pool identity needs to have access to the folder. What that is? It could be one of several things. Like he said take a look which app pool the application runs under, then take a look at that app pool's identity. Usually the identity is applicationpoolidentity which is a special IIS user. They are members of IIS_IUSRS group, so give that group access. Or the identity could be a custom user, local or domain. Or networkservice.
 
Status
Not open for further replies.