使用CustomBinding的WCF服务配置HTTPS [英] WCF Service configuration HTTPS with CustomBinding

查看:303
本文介绍了使用CustomBinding的WCF服务配置HTTPS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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看起来像这样:

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>

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

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.

谢谢

Ray

推荐答案

我认为您需要删除< security> 元素,然后更改httpTransport元素到httpsTransport,如下例所示:

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>

以下链接可能会对您有所帮助:
http://msdn.microsoft.com/en-us/library/ms731818.aspx

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

这篇关于使用CustomBinding的WCF服务配置HTTPS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆