WCF配置文件---netTcpBinding
一个服务端配置文件:
上面是WCF服务端配置文件,添加了2个终结点,一个采用的是netTcpBinding协议,一个采用的是mexTcpBinding协议。
那传输的时候,到底使用的是哪个协议啊?address为什么写成mex啊?
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<customErrors mode="Off" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="metadataBehavior">
<serviceMetadata httpGetEnabled="false"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<netTcpBinding>
<binding name="netTcpBindingConfiguration">
<readerQuotas maxDepth="64" maxStringContentLength="2147483647 " maxArrayLength="2147483647 " maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
<security mode="Transport">
<transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
</security>
</binding>
</netTcpBinding>
</bindings>
<services>
<service name="Services.MyService" behaviorConfiguration="metadataBehavior">
<endpoint address="MyService" binding="netTcpBinding" contract="Contracts.IService" bindingConfiguration="netTcpBindingConfiguration" />
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:9999/"/>
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
上面是WCF服务端配置文件,添加了2个终结点,一个采用的是netTcpBinding协议,一个采用的是mexTcpBinding协议。
那传输的时候,到底使用的是哪个协议啊?address为什么写成mex啊?
...全文
相关推荐
WCF netTcpBinding 双工通信 实时连接断开检测
**配置和服务行为**:在WCF中,可以通过配置文件设置连接超时、重试策略等参数,以优化连接管理和断开检测。8.
WCF不使用配置文件实现双工通信
通常,WCF使用配置文件(如app.config)来定义服务的行为、绑定、终结点等设置。然而,有时为了简化部署或特定需求,我们可能需要不依赖配置文件来实现双工通信。
一个简单的wcf使用nettcpbing例子
通过运行这个示例,我们可以了解如何在.NET环境中设置和使用NetTCPBinding的WCF服务。这个例子是一个很好的起点,帮助开发者理解WCF的基础工作原理和NetTCPBinding的使用。
WCFService可以通过web调用和WCF服务访问
要实现上述功能,开发者需要进行以下步骤:- **服务端配置**:在服务的配置文件中定义两个终结点,一个使用WSHttpBinding以支持Web调用,另一个使用NetTcpBinding或NetNamedPipeBinding
WCF 双工代码
**NetTcpBinding**: NetTcpBinding是WCF内置的一种高效率、安全的绑定,它默认支持双工通信。


