【问题标题】:Problem with: Access to the path '$(sourceFolder)\Foundation\Articles\serialization' is denied问题:拒绝访问路径 \'$(sourceFolder)\\Foundation\\Articles\\serialization\'
【发布时间】:2022-11-04 02:53:53
【问题描述】:

“/”应用程序中的服务器错误。

拒绝访问路径“$(sourceFolder)\Foundation\Articles\serialization”。

描述:当前 Web 请求执行期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详情:System.UnauthorizedAccessException:对路径“$(sourceFolder)\Foundation\Articles\serialization”的访问被拒绝。

ASP.NET 无权访问请求的资源。考虑向 ASP.NET 请求标识授予对资源的访问权限。 ASP.NET 有一个基本进程标识(通常是 IIS 5 上的 {MACHINE}\ASPNET 或 IIS 6 和 IIS 7 上的网络服务,以及 IIS 7.5 上配置的应用程序池标识),如果应用程序不是模拟的,则使用该标识。如果应用程序通过 模拟,则身份将是匿名用户(通常是 IUSR_MACHINENAME)或经过身份验证的请求用户。

要授予 ASP.NET 对文件的访问权限,请在文件资源管理器中右键单击该文件,选择“属性”并选择“安全”选项卡。单击“添加”以添加相应的用户或组。突出显示 ASP.NET 帐户,然后选中所需访问权限的框。

源错误:

在执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常起源和位置的信息。

堆栈跟踪:

[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 尝试了以下建议:

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

1)打开 Internet 信息系统 (IIS) 管理器
2)展开您要修改的网站(点击名称旁边的加号)3)右键单击您希望能够写入文件的目录并选择编辑权限 4)单击安全选项卡5)单击组和用户列表下的编辑...6)从“组或用户名”列表中选择 IIS_IUSRS 并添加确保将“允许”复选框标记为“写入”。


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

一个非常简单的解决方法来解决我的问题,在IIS我不得不右键单击应用程序池将 .NET Framework V4 设置为集成而不是经典/. 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)我去了 wwwroot 文件夹。右键单击和安全选项卡。提供 IISUSER 设置对 wwwroot 文件夹的读写权限。(2)将应用程序池更改为单独的池,并将标识设置为应用程序池标识。


Iv尝试了其他事情,但到目前为止没有成功

【问题讨论】:

  • 似乎您正在尝试创建一个文件夹,但您不被允许。为什么要创建文件夹?字符串中的$(sourceFolder) 听起来是错误的。您是否错过了将该占位符与某个文件夹的真实路径交换?

标签: c# asp.net iis sitecore


【解决方案1】:

看起来您正在尝试创建一个以“$(sourceFolder)”开头的文件夹,但效果不佳。您是否缺少变量定义,例如:
&lt;sc.variable name="sourceFolder" set:value="c:whatever" /&gt;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-11-11
    • 2011-03-29
    • 1970-01-01
    • 1970-01-01
    • 2010-09-24
    相关资源
    最近更新 更多