如何找出导致 Azure B2C 500 内部服务器错误的原因?

How do I find out what is causing Azure B2C 500 Internal Server Error?

我正在尝试将编排步骤添加到我的 Azure B2C IEF 用户旅程中,但是,当我进行更改时,我经常会收到错误:“500 - 内部服务器错误”

我尝试过使用 Application Insights,但这并没有告诉您与错误 500 相关的任何信息。

这是我的技术资料

    <TechnicalProfile Id="Step1">
      <DisplayName>Step 1</DisplayName>
      <Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.SelfAssertedAttributeProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
      <OutputClaims>
        <OutputClaim ClaimTypeReferenceId="email" PartnerClaimType="Email" Required="true"/>
        <OutputClaim ClaimTypeReferenceId="newPassword" Required="true" />
        <OutputClaim ClaimTypeReferenceId="reenterPassword" Required="true" />
      </OutputClaims>
    </TechnicalProfile>

这是我的用户旅程步骤

    <OrchestrationStep Order="3" Type="ClaimsExchange">
      <Preconditions>
        <Precondition Type="ClaimsExist" ExecuteActionsIf="true">
          <Value>objectId</Value>
          <Action>SkipThisOrchestrationStep</Action>
        </Precondition>
      </Preconditions>
      <ClaimsExchanges>
        <ClaimsExchange Id="SignUpWithLogonEmailExchange" TechnicalProfileReferenceId="Step1" />
      </ClaimsExchanges>
    </OrchestrationStep>

有没有办法找出导致这 500 个内部服务器错误的原因?

ContentDefinitionSelfAssertedAttributeProvider 技术配置文件必须在 Metadata 部分中指定 ContentDefinition。您的技术资料中缺少这一点。

OutputClaims:

技术简介Step1中没有ValidationTechnicalProfile。这可能 可能 成为一个问题。由于这些是 OutputClaims,策略必须指定一种方法来为每个创建一个值(即使在 运行 时它可能实际上没有被创建)。因此 OutputClaim 必须具有以下三个之一:

  1. 指定一个 DefaultValue,这保证它在 TechnicalProfile 被调用后将具有该值。
  2. ClaimsSchema 部分下的 ClaimType 中指定一个 UserInputType,这表明有一种方法可以从用户那里检索该值。
  3. 将其指定为 ValidationTechnicalProfileOutputClaim,这将允许另一个提供程序检索此类值(例如,从 AD Graph 或 Rest API)。

CryptographicKeys: SelfAssertedAttributeProvider TechnicalProfile 还需要一个 CryptographicKeys 部分来指定提供商使用的密钥。

我建议从 Starter Packs Github 复制一份技术资料并进行修改,因为它们将包含所有必需的元素。

(服务返回 500 是一个错误,需要修复。)