小编aun*_*ghn的帖子

WCF在http和https上都有自定义绑定

我有一个带有自定义绑定的WCF服务,它在http或https上工作正常.但我完全不知道如何在http和https上提供它?

也可以这样做吗?

这是我在web.config中的配置.

<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
<behaviors>
    <serviceBehaviors>
        <behavior name="">
            <serviceMetadata httpsGetEnabled="true" />                    
            <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>         
    </serviceBehaviors>
</behaviors>
<bindings>
    <customBinding>                     
        <binding name="customBinding0">
          <binaryMessageEncoding />
          <httpsTransport />
        </binding>
    </customBinding>
</bindings>
<services>
    <service name="MyWCFService">                           
        <endpoint address="" binding="customBinding" bindingConfiguration="customBinding0"
            contract="MyWCFService" />
        <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
    </service>      
</services>
Run Code Online (Sandbox Code Playgroud)

谢谢

https wcf http custom-binding

10
推荐指数
1
解决办法
1万
查看次数

标签 统计

custom-binding ×1

http ×1

https ×1

wcf ×1