0

Server Error in '/' Application.

Access to the path '$(sourceFolder)\Foundation\Articles\serialization' 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 '$(sourceFolder)\Foundation\Articles\serialization' 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 , 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 '$(sourceFolder)\Foundation\Articles\serialization' is denied.]
   System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +435
   System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost) +1436
   System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost) +98
   Rainbow.Storage.SerializationFileSystemDataStore.InitializeRootPath(String rootPath) +346
   Rainbow.Storage.SerializationFileSystemDataStore..ctor(String physicalRootPath, Boolean useDataCache, ITreeRootFactory rootFactory, ISerializationFormatter formatter) +236
   lambda_method(Closure , Object[] ) +246
   Configy.Containers.MicroContainer.Activate(Type type, KeyValuePair`2[] unmappedConstructorParameters) +841
   Unicorn.Configuration.<>c__DisplayClass8_0.<RegisterConfigTypeInterface>b__3() +41
   System.Lazy`1.CreateValue() +734
   System.Lazy`1.LazyInitValue() +189
   Unicorn.Data.ConfigurationDataStore.RegisterForChanges(Action`2 actionOnChange) +19
   Unicorn.Data.DataProvider.UnicornDataProvider..ctor(ITargetDataStore targetDataStore, ISourceDataStore sourceDataStore, IPredicate predicate, IFieldFilter fieldFilter, IUnicornDataProviderLogger logger, IUnicornDataProviderConfiguration dataProviderConfiguration, ISyncConfiguration syncConfiguration, PredicateRootPathResolver rootPathResolver) +549
   lambda_method(Closure , Object[] ) +402
   Configy.Containers.MicroContainer.Activate(Type type, KeyValuePair`2[] unmappedConstructorParameters) +841
   Configy.Containers.MicroContainer.Resolve() +110
   System.Linq.WhereSelectArrayIterator`2.MoveNext() +145
   System.Linq.Buffer`1..ctor(IEnumerable`1 source) +284
   System.Linq.Enumerable.ToArray(IEnumerable`1 source) +90
   Unicorn.Data.DataProvider.UnicornSqlServerDataProvider..ctor(String connectionString) +222

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +223
   Sitecore.Reflection.ReflectionUtil.CreateObject(Type type, Object[] parameters) +119
   Sitecore.Configuration.DefaultFactory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert) +108
   Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +163
   Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert) +72
   Sitecore.Configuration.DefaultFactory.CreateObject(String configPath, String[] parameters, Boolean assert) +703
   Sitecore.Configuration.DefaultFactory.CreateFromReference(XmlNode configNode, String[] parameters, Boolean assert) +170
   Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +116
   Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert) +72
   Sitecore.Configuration.DefaultFactory.GetInnerObject(XmlNode paramNode, String[] parameters, Boolean assert) +947
   Sitecore.Configuration.DefaultFactory.AssignProperties(XmlNode configNode, String[] parameters, Object obj, Boolean assert, Boolean deferred, IFactoryHelper helper) +545
   Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +326
   Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert) +72
   Sitecore.Configuration.DefaultFactory.CreateObject(String configPath, String[] parameters, Boolean assert) +703
   Sitecore.Configuration.DefaultFactory.GetDatabase(String name, Boolean assert) +157
   Sitecore.XA.Foundation.Multisite.Providers.SxaSiteProvider.GetSiteList() +51
   Sitecore.XA.Foundation.Multisite.Providers.SxaSiteProvider.InitializeSites() +105
   Sitecore.XA.Foundation.Multisite.Providers.SxaSiteProvider.GetSites() +18
   System.Linq.<SelectManyIterator>d__17`2.MoveNext() +265
   Sitecore.Sites.SiteCollection.AddRange(IEnumerable`1 sites) +221
   Sitecore.Sites.SitecoreSiteProvider.GetSites() +258
   Sitecore.Sites.DefaultSiteContextFactory.GetSites() +253
   Sitecore.XA.Foundation.Multisite.SiteInfoResolver.get_Sites() +60
   Sitecore.XA.Foundation.Multisite.Pipelines.Initialize.InitSiteManager.Process(PipelineArgs args) +85
   (Object , Object ) +9
   Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +490
   Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists) +236
   Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22
   Sitecore.Nexus.Web.HttpModule.Application_Start() +220
   Sitecore.Nexus.Web.HttpModule.Init(HttpApplication app) +1165
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +584
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +168
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +277
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +369

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +532
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +111
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +724

Iv tried suggestions taken from the following:

Problems with error: "Access to the path is denied."

1) Open Internet Information Systems (IIS) Manager
2) Expand the site you want to modify (hit the plus next to the name) 3) Right-click the directory where you would like to be able to write files and select Edit Permissions 4) Click on the Security tab 5) Click on Edit... under the group and users list 6) Select IIS_IUSRS from the "Groups or user names" list and add make sure the Allow checkbox is marked for Write.


ASP.NET is not authorized to access the requested resource when accessing temp folder

a really simple fix to solve my issue, in IIS I had to right click on Application Pools and set .NET Framework V4 to Integrated rather than classic/. Another solution was to set the specific folder that was being accessed to read/write to the users that required it, this can be done by unique users or within an organization, a group of users


(https://stackoverflow.com/a/47503132/19587900)

(1) I have gone to wwwroot folder. Right-click and security tab. Provided IISUSER to set read and write permission to the wwwroot folder. (2) Changed the application pool to the separate pool and set identity to Application pool Identity.


Iv tried other things but so far no success

valleLem
  • 1
  • 1
  • Seems you are trying to create a folder and you are not allowed. Why you are creating a folder? `$(sourceFolder)` in the string sounds wrong. Do you missed exchanging that placeholder with a real path to a folder somewhere? – Ralf Nov 03 '22 at 16:06

1 Answers1

0

Looks like you're trying to create a folder that starts with "$(sourceFolder)", that's not going to work well. Are you missing a variable definition like:
<sc.variable name="sourceFolder" set:value="c:\whatever" />

MStodd
  • 4,716
  • 3
  • 30
  • 50