7

我需要对 WCF 服务进行自定义绑定,以允许我将原始内容传递给 WCFRest 服务。效果很好,但我无法让它接受传输级别的安全性。我想要 https 和 basicauthentication,就像我在其他地方使用的一样。端点如下所示:

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

但系统抱怨安全节点中不允许使用模式属性。没有安全节点,一切都很好,但它不是 https。

谢谢

射线

4

1 回答 1

12

我认为您需要删除该<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

于 2013-10-07T21:15:18.423 回答