Accessed denied issue - General Discussions - General Discussions - Progress Community
 General Discussions

Accessed denied issue

  • Accessed denied issue
  • I can run Sitefinity 4.0 RC perfectly in VS2010.  But, if I use VS2010 to publish the web application to an IIS server, I run into issues.

    The message I keep getting is below.  I have tried giving the IUSR access to path mentioned, but it didn't seem to resolve the problem.  Any suggestions on how to deal with this issue?

    Server Error in '/test' Application.

    Access to the path 'D:\inetpub\wwwroot\test\App_Data\Sitefinity\Configuration\SecurityConfig.config' 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 'D:\inetpub\wwwroot\test\App_Data\Sitefinity\Configuration\SecurityConfig.config' 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.
  • Hi Stephen,

    This is a general ASP.NET error. The account that runs your application pool does not have permissions over the App_Data, its subfolders and items.

    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  • Can you give us a bit more of a solution? For those of us that might be a bit new to this and what sort of permissions or account needs to be used to fix this problem.
  • Hi Robert,

    The account that runs ASP.NET worker process (generally NETWORK SERVICE ) should have Read/Write permissions over App_Data.

    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  • I'm having this same issue on a brand new SF 4.0 site I set up in our cloud environment.  The physical path is a UNC location, and we are using a domain account as the physical path credentials and for the app pool identity.  This set up has worked on 3.x versions of Sitefinity, but doesn't seem to be here for some reason.  The App_Data folder definitely has the domain account added with full control...  Any ideas?

    Thanks, DanO
  • Hello Dan,

    Could you please post the whole error? Is it absolutely the same error reported by the first person? 

    All the best,
    the Telerik team
  • Yep - same error:

    [UnauthorizedAccessException: Access to the path '\\XXcloudad1\users\dobrien\Projects\XXX\XXX.Web\Main\Src\XXX.Web.UI\App_Data\Sitefinity\Configuration\SecurityConfig.config' is denied.]
       System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +9726046
       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) +1142
       System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) +83
       System.Xml.XmlWriterSettings.CreateWriter(String outputFileName) +142
       System.Xml.XmlWriter.Create(String outputFileName, XmlWriterSettings settings) +23
       Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.GetConfigurationWriter(ConfigSection section) +117
       Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.SaveSectionInternal(ConfigSection section) +58
       Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.SaveSection(ConfigSection section) +87
       Telerik.Sitefinity.Configuration.ConfigManager.SaveSection(ConfigSection section) +25
       Telerik.Sitefinity.Security.SecurityManager..cctor() +384

    [TypeInitializationException: The type initializer for 'Telerik.Sitefinity.Security.SecurityManager' threw an exception.]
       Telerik.Sitefinity.Security.SecurityManager.GetCurrentUser() +0
       Telerik.Sitefinity.Configuration.UserPolicyHandler.GetPolicyNames(ConfigProvider configProvider, ConfigSection section) +27
       Telerik.Sitefinity.Configuration.ConfigElement.GetValueFromPolicy(ConfigPolicyHandler handler, ConfigProperty prop, Object& value) +101
       Telerik.Sitefinity.Configuration.ConfigElement.GetPolicyValue(ConfigProperty prop, Object& value) +87
       Telerik.Sitefinity.Configuration.ConfigElement.get_Item(ConfigProperty prop) +56
       Telerik.Sitefinity.Configuration.ConfigElement.get_Item(String propertyName) +68
       Telerik.Sitefinity.Localization.Configuration.ResourcesConfig.get_Providers() +17
       Telerik.Sitefinity.Localization.ResourceManager.get_ProvidersSettings() +23
       Telerik.Sitefinity.Data.ManagerBase`1.GetProvidersSettings() +10
       Telerik.Sitefinity.Data.ManagerBase`1.Initialize() +507
       Telerik.Sitefinity.Data.ManagerBase`1..ctor(String providerName, String transactionName) +24
       Telerik.Sitefinity.Localization.ResourceManager..ctor() +21
       Telerik.Sitefinity.Localization.Res..cctor() +21

    [TypeInitializationException: The type initializer for 'Telerik.Sitefinity.Localization.Res' threw an exception.]
       Telerik.Sitefinity.Localization.Res.RegisterResource() +0
       Telerik.Sitefinity.Abstractions.ObjectFactory.RegisterIoCTypes() +1035
       Telerik.Sitefinity.Abstractions.Bootstrapper.Bootstrap() +87
       Telerik.Sitefinity.Web.SitefinityHttpModule.Init(HttpApplication context) +24
       System.Web.Routing.UrlRoutingModule.System.Web.IHttpModule.Init(HttpApplication application) +10
       System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +431
       System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +194
       System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +339
       System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +253

    [HttpException (0x80004005): The type initializer for 'Telerik.Sitefinity.Localization.Res' threw an exception.]
       System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8950644
       System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
       System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +256

  • Hi Dan,

    Actually, you might have access rights to the App_data, but not to Sitefinity\Configuration\. In other words, the permissions inheritance might not be set, and you may try to give permissions over the entire directory tree under the App_Data, not just on App_data. 

    the Telerik team
  • We have permissions set for that domain user at the root of the site and inheritance is turned on.  I've even checked at the file level, and the user our site is running under has full control of the SecurityConfig.config file. 

    Have you tried to reproduce this problem by creating a Sitefinity 4.0 site that uses a UNC path as it's Physical Path, and uses a domain account to authenticate?

    I have a feeling if you try that you will reproduce the error.  It seems like there is some local identity that needs access to that file, but I don't know which one or why...

    Thanks, Dan
  • We figured out what the issue is - the files are read-only since they were checked into source control.  Are these files supposed to be excluded from source control?

    Thanks, Dan
  • Hi Dan,

    The files in App_Data should not be excluded from the source control. We use App_Data as a data storage for the configurations and if you exclude these files there will be difference for the users that use the solution.

    Ivan Dimitrov
    the Telerik team
  • So to clarify - should the entire App_Data directory be included in source control?  I'm confused as to why more people aren't running into this issue.  It doesn't seem like the problem has anything to do with the fact that our local sites are pointing to a UNC location.

    If the application needs to write to files that are in source control at runtime they are going to have to be checked out anytime the application is running locally.  That seems like a headache.  Is there something I am missing?

    Thanks, Dan
  • We are running into the same issue as Dan. Using a source control (we're using Vault) it's a bit annoying to have to keep checking out the whole App_Data folder when browsing the site from Visual Studio. Any assistance on this?

  • Hi Dan,

    Sitefinity configuration and the database are closely related. There are configuration settings,  persisted for one database, could not be relevant to another database and this is why you need to put the project in source control after it has been installed. The files inside App_Data will be check out and checked it with the changes made by each person. There might be some conflicts related to  setting some values like ID of the home page or adding widgets, because before you start working you should get the latest version from the source control and you should have a notification for each checkin.

    Ivan Dimitrov
    the Telerik team