我需要 WCF 服务上的自定义绑定,以允许我将原始内容传递到 WCFRest 服务。效果很好,但我无法让它接受传输级安全性。我想要 https 和 basicauthentication,就像我在其他地方使用的那样。端点看起来像这样:
<endpoint address="" behaviorConfiguration="web" contract="SmsService.ISmsReceive" binding="customBinding" bindingConfiguration="RawReceiveCapable"></endpoint>
自定义绑定看起来像这样:
<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。
Thanks
Ray
我认为你需要放弃<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 http://msdn.microsoft.com/en-us/library/ms731818.aspx
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)