首页 > 解决方案 > WCF Ws-安全服务配置

问题描述

我对围绕我的 WCF 服务和 WS-Seciurity 的配置有问题。我无权访问客户端,到目前为止,我正在尝试使用 SoapUI 作为具有 WS-A 寻址、用户名、密码和 WSS 密码类型“PasswordDigest”选项的客户端。

我使用带有简单证书 .NET 4.7 的 IIS 和 https。

我尝试了很多版本,但都没有成功。我只想找到最简单、有效的解决方案,在启用 WS-Seciurity PasswordDigest 选项的情况下从 SoapUI/客户端请求中读取“安全”标头。

当前配置文件的当前错误“InvalidSecurity”“验证消息的安全性时发生错误”

   <system.serviceModel>
    <protocolMapping>
      <add scheme="https" binding="wsHttpBinding"/>
    </protocolMapping>
    <services>
        <service name="SoapService" behaviorConfiguration="SoapServiceConf">
            <!--<endpoint address="SoapService" binding="wsHttpBinding" contract="MPA.SoapService.References.ServiceReference.SentSOAP" /> -->
          <endpoint address="" binding="wsHttpBinding" contract="Interfaces.ISoap" bindingConfiguration="wsHttpBind"/>
          <endpoint contract="IMetadataExchange" binding="mexHttpsBinding" address="mex" />
        </service>
    </services>
    <bindings>
      <wsHttpBinding>
        <binding maxReceivedMessageSize="10485760" name="wsHttpBind">
          <security mode="TransportWithMessageCredential">
            <transport clientCredentialType="Basic"/>
            <message clientCredentialType="UserName" algorithmSuite="Default" establishSecurityContext="false" />
          </security>
          <reliableSession enabled="false" />
          <readerQuotas maxArrayLength="10485760" maxDepth="1024" maxStringContentLength="10485760" />
        </binding>
      </wsHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="SoapServiceConf">
          <serviceCredentials>
            <serviceCertificate findValue="soapservice"
                                storeName="My"
                                x509FindType="FindByIssuerName" />
          </serviceCredentials>
          <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="False" />
        </behavior>
        <behavior name="MyServiceTypeBehaviors" >
          <!-- Add the following element to your service behavior configuration. -->
          <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>

谢谢。

标签: wcfsoapuiwcf-securityws-securitywcf-configuration

解决方案


推荐阅读