2013-10-07 82 views
4

我需要一个WCF服务的自定义绑定,以允许我将原始内容传递给WCFRest服务。效果很好,但我无法接受传输级别的安全性。我想在其他地方使用https和basicauthentication。端点看起来是这样的:WCF服务配置HTTPS与CustomBinding

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

customBinding看起来是这样的:

<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> 

但系统抱怨mode属性没有在安全节点允许的。没有安全节点,所有工作都很好,但不是https。

感谢

回答

6

我认为你需要删除<security>元素,然后更改httpTransport元素httpsTransport如下面的例子:

<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> 

下面的链接可能是有帮助的: http://msdn.microsoft.com/en-us/library/ms731818.aspx