为Azure Web角色中的WCF终结点添加其他SSL行为

本文关键字:添加 结点 其他 SSL 行为 WCF Web Azure 角色 | 更新日期: 2023-09-27 17:50:02

我们的azure web应用程序已经使用https端口443和我们的站点证书,我们在这个webrole中有一个WCF服务,它有一个https端点使用我们的证书进行身份验证(单向ssl(,这个服务需要一个额外的https端点支持使用我们的认证和第三方的证书进行双向身份验证。我们已经上传了证书,更新了服务定义文件,并添加了一个我们希望能工作的端点,但在测试中我们得到了错误:服务"SslRequireCert"的SSL设置与IIS"None"的设置不匹配。

所以起作用的端点是:https://environemnt.application.com/Services/Service.svc生成错误的端点:https://environment.application.com/Services/Service.svc/twa

关键的要求是,它是https,端口443,在上面的新端点上,在不改变其余角色的SSL行为的情况下,我看到了更改IIS配置或使用角色编辑器添加https输入端点的条目,但由于我们已经在端口443上使用我们的站点证书有了https输入终结点,我不想更改/影响整个角色。

如果有帮助的话,该服务是一个WCF服务,它使用Mtom编码的soap 1.2消息

这是我们输入的新价值观,我还需要什么?

<behaviors>
 <serviceBehaviors>
   <behavior name="SSLServiceBehavior">
     <serviceMetadata httpsGetEnabled="true" />
     <serviceDebug includeExceptionDetailInFaults="true" />
     <dataContractSerializer maxItemsInObjectGraph="2147483647" />
   </behavior>
 </serviceBehaviors>
 <endpointBehaviors>
  <behavior name="OneWayAuthEndpointBehavior">
  </behavior>
  <behavior name="TwoWayAuthEndpointBehavior">
      <endpointDiscovery enabled="true"></endpointDiscovery>
      <clientCredentials>
        <clientCertificate findValue="thumprint..." storeLocation="LocalMachine" storeName="CertificateAuthority" x509FindType="FindByThumbprint"  />
      </clientCredentials>
    </behavior>
 </endpointBehaviors>
</behaviors>
<services>
 <service behaviorConfiguration="SSLServiceBehavior" name="Service">
  <endpoint address="" behaviorConfiguration="OneWayAuthEndpointBehavior"binding="wsHttpBinding" bindingConfiguration="HttpsMtomOneWay" contract="ITestService" />
  <endpoint address="twa" behaviorConfiguration="TwoWayAuthEndpointBehavior" binding="wsHttpBinding" bindingConfiguration="HttpsMtomTwoWay" contract="ITestService"/>
</services>
<bindings>
 <wsHttpBinding>
  <binding name="HttpsMtomOneWay" messageEncoding="Mtom">
    <security mode="Transport">
      <transport clientCredentialType="None" />
    </security>
  </binding>
  <binding name="HttpsMtomTwoWay" messageEncoding="Mtom">
    <security mode="Transport">
      <transport clientCredentialType="Certificate" />
    </security>
  </binding>
 </wsHttpBinding>
</bindings>

非常感谢

为Azure Web角色中的WCF终结点添加其他SSL行为

通过以下步骤修复:

  • 将serviceCredentials.serviceCertificate(我们证书的证书详细信息(添加到服务行为中
  • 消除了端点行为定义
  • 已将HttpsMtomTwoWay绑定更改为securityMode=Message

现在,消息处理程序处理身份验证交换和外部证书验证,然后传递到传输端点,我们不需要处理站点范围的SSL或端点设置。与众多第三方进行测试和验证。