You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

ASP.NET MVC 5应用WS-Federation认证无法跳转至Microsoft登录页

ASP.NET MVC 5 无法跳转至Microsoft登录页排查求助

我的ASP.NET MVC 5 Web应用无法跳转至https://login.microsoftonline.com,但我认为相关配置设置均正确,具体配置和已尝试内容如下:

已配置的代码与设置

Global.asax.cs 事件处理代码

private void WSFederationAuthenticationModule_RedirectingToIdentityProvider(object sender, RedirectingToIdentityProviderEventArgs e)
{
    if (!String.IsNullOrEmpty(IdentityConfig.Realm))
    {
        e.SignInRequestMessage.Realm = IdentityConfig.Realm;
    }
}

web.config 相关配置

appSettings 节点

<add key="ida:FederationMetadataLocation" value="https://login.microsoftonline.com/{tenant id}/federationmetadata/2007-06/federationmetadata.xml" />
<add key="ida:Realm" value="https://myapp.com" />
<add key="ida:AudienceUri" value="https://myapp.com" />
<add key="ida:ClientID" value="{client id}" />
<add key="ida:Password" value="{client secret}" />

identityConfiguration 的 audienceUris 配置

<audienceUris>
    <add value="https://myapp.com" />
</audienceUris>

wsFederation 节点配置

<federationConfiguration>
    <cookieHandler requireSsl="true" />
    <wsFederation passiveRedirectEnabled="true" issuer="https://login.microsoftonline.com/{tenant id}/wsfed" realm="https://myapp.com" requireHttps="true" />
</federationConfiguration>

Azure 门户配置

  • 在“Authentication”中设置“Web”为平台,并配置了站点URI
  • “Expose an API”中,“Application ID URI”设置为 api://{client id}

已尝试的操作

  • 查阅Microsoft官方文档《Web app tutorial》和《Configure Azure AD Login》,未找到问题原因

求助

目前不清楚问题出在哪里,希望能得到进一步的排查方向或解决方法,确认是否有遗漏的配置项或潜在问题点。

内容的提问来源于stack exchange,提问作者Keevan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.21 17:08:27