WCF-处理消息中的安全令牌时发生错误

时间:2018-11-13 19:56:53

标签: c# web-services wcf

我正在使用WCF Web服务的自定义验证。我正在使用wsHttpBinding:

 <wsHttpBinding>
        <binding name="CustomBinding">
          <security mode="TransportWithMessageCredential">
            <transport clientCredentialType="None"/>
            <message clientCredentialType="UserName" negotiateServiceCredential="false" establishSecurityContext="false"/>
          </security>
          <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="13107200"/>
        </binding>
      </wsHttpBinding>

我的行为如下:

    <behavior name="SecureServiceBehavior" >
      <serviceThrottling maxConcurrentCalls="1000" maxConcurrentSessions="1000" maxConcurrentInstances="1000"/>
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="true"/>
      <serviceCredentials>
        <userNameAuthentication userNamePasswordValidationMode="Custom" includeWindowsGroups="false" customUserNamePasswordValidatorType="PSA904.CustomValidator, PSA904"/>
        <windowsAuthentication includeWindowsGroups="false"/>
      </serviceCredentials>
    </behavior>

我的服务看起来像这样:

<services>
  <service name="PSA904.PSA904External" behaviorConfiguration="SecureServiceBehavior" >
    <endpoint binding="wsHttpBinding" contract="PSA904.IPSA904External" bindingConfiguration="CustomBinding"/>
  </service>
  <service name="PSA904.PSA904Internal" behaviorConfiguration="SecureServiceBehavior" >
    <endpoint binding="wsHttpBinding" contract="PSA904.IPSA904Internal" bindingConfiguration="CustomBinding"/>
  </service>
</services>

当我部署应用程序时,它显示此错误:

System.ServiceModel.FaultException:处理消息中的安全令牌时发生错误。

0 个答案:

没有答案