gpt4 book ai didi

c# - Azure 云服务上的 Umbraco 7.0.2 - 访问路径 'E:\sitesroot\1\config\applications.config' 被拒绝

转载 作者:太空狗 更新时间:2023-10-29 23:45:56 26 4
gpt4 key购买 nike

我有一个在 Azure 上运行的云服务,我正在尝试将 Umbraco 作为 VirtualApplication 添加到 WebRole:

ServiceDefinition.csdef:

...
<Site name="Web">
<VirtualApplication name="cms" physicalDirectory="../../../umbracocms" />
...

它在模拟器上的本地计算机上完美运行,但是当我将包部署到 Azure 云服务时,我无法访问 Umbraco 页面,它返回以下错误:

Access to the path 'E:\sitesroot\1\config\applications.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 'E:\sitesroot\1\config\applications.config' is denied.

堆栈跟踪:

[UnauthorizedAccessException: Access to the path 'E:\sitesroot\1\config\applications.config' 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) +205
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync) +112
System.Xml.XmlWriterSettings.CreateWriter(String outputFileName) +7430688
System.Xml.Linq.XDocument.Save(String fileName, SaveOptions options) +189
Umbraco.Core.Services.SectionService.LoadXml(Action`1 callback, Boolean saveAfterCallback) +253
Umbraco.Core.EnumerableExtensions.ForEach(IEnumerable`1 items, Action`1 action) +148
Umbraco.Core.CoreBootManager.Complete(Action`1 afterComplete) +116
Umbraco.Web.WebBootManager.Complete(Action`1 afterComplete) +337

[HttpException (0x80004005): Access to the path 'E:\sitesroot\1\config\applications.config' is denied.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +12582201
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +175
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +304
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +404
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475

[HttpException (0x80004005): Access to the path 'E:\sitesroot\1\config\applications.config' is denied.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12599232
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12438981

我已经尝试添加启动任务但没有成功:

<Startup priority="1">
<Task commandLine="startup.bat" executionContext="elevated" taskType="simple" />
</Startup>

启动.bat:

echo "starting startup task" >> log.txt
%windir%\system32\Icacls.exe ..\* /T /grant "Network Service":(F) > log.txt

还要添加对 Web 角色的 OnStart 事件的权限,如下所示 URL 。也没有成功。

当我远程桌面直接进入实例时,文件夹 E:\sitesroot\甚至不存在。

最佳答案

对于那些想知道的人。我已经找到问题了。startup.bat 脚本未成功运行。我通过将其更改为以下内容找到了答案:

startup.bat

%windir%\system32\Icacls.exe ..\..\* /T /grant "Network Service":(F) > c:\\logStart.txt 2>&1
exit /b 0

该问题与文件的编码有关。使用notepad++并将编码更改为“UTF-8 without BOM”后文件才成功运行

关于c# - Azure 云服务上的 Umbraco 7.0.2 - 访问路径 'E:\sitesroot\1\config\applications.config' 被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21382683/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com