Angular 应用已成功部署到 Azure,但访问时出现权限被拒绝消息
Angular app deployed on Azure successfully, but permission denied message while accessing it
问题
我正在尝试在 Azure 上部署 Angular 应用程序(Angular 版本 - 8.2.14)。
我曾经使用 Kudu 来部署应用程序,代码是从我的 Github Repo 部署的。部署状态为 'success'。
访问已部署的 Web 应用程序 URL 时出错
"You do not have permission to view this directory or page."
已尝试解决问题的方法
为了获得有关该错误的更多详细信息,我尝试在 App Service Logs 部分启用 'Detailed Error Messages'。但我也无法从中获得太多信息。我在 'Detailed Error Messages' 中找到的唯一信息是“读取 Web 服务器或 Web 应用程序的配置文件时出现问题时会出现此错误。在某些情况下,事件日志可能包含更多有关导致此错误的原因的信息。"
我还检查了事件日志,发现以下信息,
Exception: System.IO.IOException
Message: The handle is invalid.
StackTrace: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.__ConsoleStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
at System.IO.StreamWriter.Write(String value)
at System.IO.TextWriter.SyncTextWriter.Write(String value)
at Kudu.Core.Infrastructure.ProgressWriter.IdleWriter(Object state) in C:\Kudu Files\Private\src\master\Kudu.Core\Infrastructure\ProgressWriter.cs:line 109
at System.Threading.TimerQueueTimer.CallCallbackInContext(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.TimerQueueTimer.CallCallback()
at System.Threading.TimerQueueTimer.Fire()
at System.Threading.TimerQueue.FireNextTimers()
at System.Threading.TimerQueue.AppDomainTimerCallback(Int32 id)</Data></EventData></Event><Event><System><Provider Name="HttpPlatformHandler"/><EventID>2000</EventID><Level>4</Level><Task>0</Task><Keywords>Keywords</Keywords><TimeCreated SystemTime="2020-05-01T16:57:34Z"/><EventRecordID>385268109</EventRecordID><Channel>Application</Channel><Computer>RD501AC5040133</Computer><Security/></System><EventData><Data>APPLICATION_MANAGER::~APPLICATION_MANAGER | this=05B6D878 [TID 6180] [PID 5664]</Data></EventData></Event><Event><System><Provider Name=".NET Runtime"/><EventID>1026</EventID><Level>1</Level><Task>0</Task><Keywords>Keywords</Keywords><TimeCreated SystemTime="2020-05-01T16:57:35Z"/><EventRecordID>385269218</EventRecordID><Channel>Application</Channel><Computer>RD501AC5040133</Computer><Security/></System><EventData><Data>Application: w3wp.exe
Framework Version: v4.0.30319
我正在尝试其他选项(主要是查看有关在 Azure 上部署 Angular 应用程序的教程),但还没有幸运地解决此问题。
web.config
<!-- indicates that the index.js file is a node.js application
to be handled by the iisnode module -->
<handlers>
<add name="iisnode" path="index.js" verb="*" modules="iisnode" />
</handlers>
<!-- adds index.js to the default document list to allow
URLs that only specify the application root location,
e.g. http://mysite.antarescloud.com/ -->
<defaultDocument enabled="true">
<files>
<add value="index.js" />
</files>
</defaultDocument>
<system.web>
<customErrors mode="Off" />
</system.web>
</system.webServer>
</configuration>
根据您收到的错误消息,应用程序文件似乎没有部署到预期位置。
请在此处参考我的文章(法语):http://espacenuagic.com/2019/03/10/deployer-une-application-angular-sur-azure-app-service/
请特别注意您正在部署的内容,如图所示:
在此示例中,我部署的是 'angled' 文件夹的内容,而不是 'dist' 文件夹的内容。
希望对您有所帮助。
问题已解决。在配置部分 - 路径映射下,我不得不将物理路径的值更改为 'site\wwwroot\dist'.
我遇到了类似的问题。就我而言,我忘记在概览菜单中按“运行”按钮。
问题 我正在尝试在 Azure 上部署 Angular 应用程序(Angular 版本 - 8.2.14)。 我曾经使用 Kudu 来部署应用程序,代码是从我的 Github Repo 部署的。部署状态为 'success'。
访问已部署的 Web 应用程序 URL 时出错 "You do not have permission to view this directory or page."
已尝试解决问题的方法 为了获得有关该错误的更多详细信息,我尝试在 App Service Logs 部分启用 'Detailed Error Messages'。但我也无法从中获得太多信息。我在 'Detailed Error Messages' 中找到的唯一信息是“读取 Web 服务器或 Web 应用程序的配置文件时出现问题时会出现此错误。在某些情况下,事件日志可能包含更多有关导致此错误的原因的信息。"
我还检查了事件日志,发现以下信息,
Exception: System.IO.IOException
Message: The handle is invalid.
StackTrace: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.__ConsoleStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
at System.IO.StreamWriter.Write(String value)
at System.IO.TextWriter.SyncTextWriter.Write(String value)
at Kudu.Core.Infrastructure.ProgressWriter.IdleWriter(Object state) in C:\Kudu Files\Private\src\master\Kudu.Core\Infrastructure\ProgressWriter.cs:line 109
at System.Threading.TimerQueueTimer.CallCallbackInContext(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.TimerQueueTimer.CallCallback()
at System.Threading.TimerQueueTimer.Fire()
at System.Threading.TimerQueue.FireNextTimers()
at System.Threading.TimerQueue.AppDomainTimerCallback(Int32 id)</Data></EventData></Event><Event><System><Provider Name="HttpPlatformHandler"/><EventID>2000</EventID><Level>4</Level><Task>0</Task><Keywords>Keywords</Keywords><TimeCreated SystemTime="2020-05-01T16:57:34Z"/><EventRecordID>385268109</EventRecordID><Channel>Application</Channel><Computer>RD501AC5040133</Computer><Security/></System><EventData><Data>APPLICATION_MANAGER::~APPLICATION_MANAGER | this=05B6D878 [TID 6180] [PID 5664]</Data></EventData></Event><Event><System><Provider Name=".NET Runtime"/><EventID>1026</EventID><Level>1</Level><Task>0</Task><Keywords>Keywords</Keywords><TimeCreated SystemTime="2020-05-01T16:57:35Z"/><EventRecordID>385269218</EventRecordID><Channel>Application</Channel><Computer>RD501AC5040133</Computer><Security/></System><EventData><Data>Application: w3wp.exe
Framework Version: v4.0.30319
我正在尝试其他选项(主要是查看有关在 Azure 上部署 Angular 应用程序的教程),但还没有幸运地解决此问题。
<!-- indicates that the index.js file is a node.js application
to be handled by the iisnode module -->
<handlers>
<add name="iisnode" path="index.js" verb="*" modules="iisnode" />
</handlers>
<!-- adds index.js to the default document list to allow
URLs that only specify the application root location,
e.g. http://mysite.antarescloud.com/ -->
<defaultDocument enabled="true">
<files>
<add value="index.js" />
</files>
</defaultDocument>
<system.web>
<customErrors mode="Off" />
</system.web>
</system.webServer>
</configuration>
根据您收到的错误消息,应用程序文件似乎没有部署到预期位置。
请在此处参考我的文章(法语):http://espacenuagic.com/2019/03/10/deployer-une-application-angular-sur-azure-app-service/ 请特别注意您正在部署的内容,如图所示:
在此示例中,我部署的是 'angled' 文件夹的内容,而不是 'dist' 文件夹的内容。
希望对您有所帮助。
问题已解决。在配置部分 - 路径映射下,我不得不将物理路径的值更改为 'site\wwwroot\dist'.
我遇到了类似的问题。就我而言,我忘记在概览菜单中按“运行”按钮。