您的位置:首页 > 其它

WCF Binding实例

2015-08-19 10:59 288 查看
BasicHttpBinding

<?xml version="1.0"?>
<configuration>
<system.web>
<httpRuntime maxRequestLength="2097151" />
</system.web>
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="metadataBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>

<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding_A" receiveTimeout="00:10:00" sendTimeout="00:10:00" openTimeout="00:10:00" closeTimeout="00:10:00"
maxReceivedMessageSize="65536" maxBufferSize="65536" maxBufferPoolSize="524288" transferMode="Buffered" messageEncoding="Text"
textEncoding="utf-8" bypassProxyOnLocal="false" useDefaultWebProxy="true" hostNameComparisonMode="StrongWildcard">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxNameTableCharCount="2147483647" maxBytesPerRead="2147483647" />
<security mode="None" />
<!--None、Transport、Message、TransportWithMessageCredential-->
</binding>
</basicHttpBinding>
</bindings>

<client>
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpBinding_A" contract="契约地址" behaviorConfiguration="metadataBehavior" />
</client>
</system.serviceModel>
</configuration>


WSHttpBinding

<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="metadataBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_A" closeTimeout="00:55:00" openTimeout="00:55:00" receiveTimeout="00:55:00" sendTimeout="00:55:00"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" useDefaultWebProxy="false" allowCookies="false"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="Transport"><!--None、Transport、Message、TransportWithMessageCredential-->
<transport clientCredentialType="Windows" /><!--None、Basic、Digest、Ntlm、Windows、Certificate-->
<message clientCredentialType="Windows"/><!--None、Windows、UserName、Certificate、IssuedToken-->
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://localhost:444/soap12" behaviorConfiguration="metadataBehavior"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ISyncReply"
contract="ServiceReference1.ISyncReply" name="WSHttpBinding_ISyncReply" />
</client>
</system.serviceModel>


CustomBinding

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="WSHttpBinding_IOneWay" >
<textMessageEncoding messageVersion="Soap12">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</textMessageEncoding>
<httpsTransport maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" />
</binding>
<binding name="WSHttpBinding_ISyncReply">
<textMessageEncoding messageVersion="Soap12">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</textMessageEncoding>
<httpsTransport maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" />
</binding>
</customBinding>
</bindings>

<client>
<endpoint address="https://localhost:444/soap12" binding="customBinding"
bindingConfiguration="WSHttpBinding_IOneWay" contract="I2WebService.IOneWay"
name="WSHttpBinding_IOneWay" />
<endpoint address="https://localhost:444/soap12" binding="customBinding"
bindingConfiguration="WSHttpBinding_ISyncReply" contract="I2WebService.ISyncReply"
name="WSHttpBinding_ISyncReply" />
</client>
</system.serviceModel>
</configuration>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: