2014-01-27 55 views
4

我有一個在Azure上運行的Cloud Service,我試圖添加Umbraco作爲VirtualApplication到WebRole:Azure雲服務上的Umbraco 7.0.2 - 訪問路徑'E: sitesroot 1 config applications.config'被拒絕

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> 

的startup.bat:

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

並且還要添加permis請參閱網頁角色的OnStart事件,如URL所示。 它也沒有工作。

當我遠程桌面直接進入實例時,文件夾E:\ sitesroot \甚至不存在。

回答

1

對於那些想知道的人。我發現了這個問題。 startup.bat腳本沒有成功運行。我能夠將其更改爲以下找出:

的startup.bat

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

而且問題涉及到文件的編碼。該文件僅在使用記事本++並將編碼更改爲「無BOM的UTF-8」後才能成功運行