【发布时间】:2021-02-04 00:14:18
【问题描述】:
我创建了带有 Azure AD 身份验证的 ASP.net Core 2.1 Web 项目。所以它在 appsettings.json 中有以下值。
"AzureAd": {
"Instance": "https://login.microsoftonline.com/",
"Domain": "mycompany.onmicrosoft.com",
"TenantId": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"ClientId": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"CallbackPath": "/signin-oidc"
},
它会自动将重定向 URL 设置为“https://localhost:44362/signin-oidc”。该 Web 项目依次调用 ASP.Net Core 2.1 Web API 来获取数据。我已将这两个项目部署到 Azure 应用服务。
当我尝试访问已部署的 Web 应用程序时,我收到错误消息“您无权查看此目录或页面。”
除了现有的本地主机 URL,我还添加了以下重定向 URL。
- https://myweb-dev.azurewebsites.net
- https://myweb-dev.azurewebsites.net/signin-oidc
- https://myweb-dev.azurewebsites.net/.auth/login/aad/callback
对于应用服务,我已通过“使用 Azure Active Directory 登录”启用“身份验证/授权”。并将管理模式配置为高级。
我启用了包含以下信息的详细错误。
<table border="0" cellpadding="0" cellspacing="0">
<tr class="alt"><th>Requested URL</th><td> https://myweb-Dev:80/signin-oidc</td></tr>
<tr><th>Physical Path</th><td> D:\home\site\wwwroot\signin-oidc</td></tr>
<tr class="alt"><th>Logon Method</th><td> Not yet determined</td></tr>
<tr><th>Logon User</th><td> Not yet determined</td></tr>
</table>
<div class="content-container">
<fieldset><h4>More Information:</h4>
This generic 403 error means that the authenticated user is not authorized to use the requested resource.
A substatus code in the IIS log files should indicate the reason for the 403 error. If a substatus code
does not exist, use the steps above to gather more information about the source of the error.
</fieldset>
</div>
请任何人帮助我识别并解决此问题。谢谢。
【问题讨论】:
-
您能否通过 KUDU 验证您已将应用部署到正确的位置:site/wwwroot ?
-
是的 Kgalic。实际上我只是通过选择现有的应用服务从 VS 发布它。
-
您的 Azure 网站中有默认页面吗?确保将启动文件(例如:index.htm)添加到默认文档部分。
-
是的,卡尔。因为是 ASP.Net Core Application,所以默认页面是hostingstart.html。
标签: azure azure-active-directory asp.net-core-2.1 azure-appservice