【问题标题】:WCF Server Configuration for ws2007FederationHttpBinding and Windows Authenticationws2007FederationHttpBinding 和 Windows 身份验证的 WCF 服务器配置
【发布时间】:2018-11-26 07:01:07
【问题描述】:

我必须在服务器上托管的服务上实施“Windows 身份验证”。
我正在使用“ws2007FederationHttpBinding”。
我正在使用“ws2007FederationHttpBinding”绑定,因为我从我的 ADFS 服务器接收令牌。

以下是我的服务器配置:

web.config

<authentication mode="Windows" />

            <ws2007FederationHttpBinding>   
              <binding name="SamlTokenCustomStsBindingConfig">
                <security mode="Message">
                  <message establishSecurityContext="false">
                  </message>
                </security>
              </binding>
           </ws2007FederationHttpBinding>

   <service name="XXX.Server" behaviorConfiguration="ClaimsAwareServiceBehavior">
        <endpoint address="http://serverurl/ServerServices.svc" binding="ws2007FederationHttpBinding" 
                  contract="ServerInterfaces.IServer"  bindingConfiguration="SamlTokenCustomStsBindingConfig"  />

        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>

 <behavior name="ClaimsAwareServiceBehavior">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior> 

下面是我的 IIS 配置:

尽管进行了所有配置,但我无法访问我的服务。任何人都可以通知我在哪里出错或我错过了任何配置。

当我尝试访问我的服务时收到以下错误。

根据错误,我们在“ws2007FederationHttpBinding”中没有“Transport”或“TransportCredentialOnly”。
所以我无法继续前进。

【问题讨论】:

  • 为什么你要使用ws2007FederationHttpBinding 只是因为WindowsAuthenticate
  • 我必须使用 ADFS 实现 Windows 身份验证,所以我使用的是“ws2007FederationHttpBinding”。还有其他选择吗?

标签: wcf iis windows-authentication adfs wsfederationhttpbinding


【解决方案1】:

您应该在下面的代码行中对此进行注释,以避免您的问题中提到的错误:

<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />

但要为 WCF 服务实施 ADFS 需要几个先决条件,这些先决条件不能作为答案发布,但仅适用于 Windows 身份验证模式,这更容易通过小步骤使用 basicHttpBinding

所以对于 ADFS 实施,请看一下:

1-ADFS in Identity Solutions - Using Active Directory Federation Services 2.0 in Identity Solutions.

2-Federated Security: How to setup and call a WCF service secured by ADFS 2.0

3-ADFS to secure WCF and Workflow Services hosted in Windows Server AppFabric.

【讨论】:

  • 我已经完成了 ADFS 配置,并且能够从服务器接收令牌。但是当我尝试在“UserNameMixed”模式下使用该服务时,它工作正常,但是当我尝试 Windows 身份验证时它失败了。
  • 请从绑定中删除 name="SamlTokenCustomStsBindingConfig" 并从服务中删除 bindingConfiguration="SamlTokenCustomStsBindingConfig" 并重试,因为与您的 occurred here 相同的异常。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-10-04
  • 2013-02-22
相关资源
最近更新 更多