WCF Service configuration HTTPS with CustomBinding

喜你入骨 提交于 2019-12-22 05:07:29

问题


I needed a custombinding on a WCF Service to allow me to pass raw content to WCFRest service. Works great, but I can't get it to accept transport level security. I want https and basicauthentication as I use elsewhere. Endpoint looks like this:

   <endpoint address="" behaviorConfiguration="web" contract="SmsService.ISmsReceive" binding="customBinding" bindingConfiguration="RawReceiveCapable"></endpoint>

customBinding looks like this:

  <customBinding>
    <binding name="RawReceiveCapable">
      <security mode="Transport">
        <transport clientCredentialType="Basic"/>
      </security>
      <webMessageEncoding webContentTypeMapperType="SmsService.RawContentTypeMapper, SmsService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
      <httpTransport manualAddressing="true" maxReceivedMessageSize="524288000" transferMode="Streamed" />
    </binding>
  </customBinding>

but system complains that mode attribute is not allowed in the security node. Without the security node all works great but it's not https.

Thanks

Ray


回答1:


I think you need to drop the <security> element and then change the httpTransport element to httpsTransport as shown in the following example:

<system.serviceModel>
    <bindings>
        <customBinding>
            <binding name="RawReceiveCapable">
              <webMessageEncoding webContentTypeMapperType="SmsService.RawContentTypeMapper, SmsService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
              <httpsTransport authenticationScheme="Basic"  manualAddressing="true" maxReceivedMessageSize="524288000" transferMode="Streamed" />
            </binding>
        </customBinding>
    </bindings>

The following link might be helpful: http://msdn.microsoft.com/en-us/library/ms731818.aspx



来源:https://stackoverflow.com/questions/19232445/wcf-service-configuration-https-with-custombinding

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!