您的位置:首页 > 理论基础 > 计算机网络

跟着Artech学习WCF(2) netTcpBinding 绑定

2011-08-21 18:32 585 查看
netTcpBinding 绑定真是坑爹啊 因为一直围绕着iis的缘故 很少搞这个东西,这次计划系统的学习WCF 才搞的

没搞不知道一搞晕菜

配置了半天才弄好

最晕菜的是在省城代理类时 的地址 更晕菜

这次配置OK了 保存一下 以备他日不时之需

首先netTcpBinding是服务器端的配置 和HTTP之类是不太一样的

配置如下

<system.serviceModel>

<!--<behaviors>
<serviceBehaviors>
<behavior name="metadataBehavior">
<serviceMetadata httpGetEnabled="true"  httpGetUrl="http://localhost:9999/calculatorservice/metadata"/>
</behavior>
</serviceBehaviors>
</behaviors>-->

<!--<services>
<service name="Services.CalculatorService">
<endpoint
address="http://localhost:9999/calculatorservice"
binding=""

contract="Contracts.ICalculator" />

</service>

</services>-->

<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.CalculatorService" behaviorConfiguration="metadataBehavior">

<endpoint address="CalculatorService"  binding="netTcpBinding" contract="Contracts.ICalculator" bindingConfiguration="netTcpBindingConfiguration"  />
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:9999/"/>
</baseAddresses>
</host>
<!--  net.tcp://localhost:9999/CalculatorService   -->
</service>
</services>
</system.serviceModel>
<system.web>
<customErrors
mode="Off"
/>

<!--closeTimeout="00:01:00"
openTimeout="00:01:00"
receiveTimeout="00:10:00"
sendTimeout="00:10:00"
transactionFlow="false"
transferMode="Buffered"
transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard"
listenBacklog="10"
maxBufferPoolSize="2147483647 "
maxBufferSize="2147483647 "
maxConnections="10"
maxReceivedMessageSize="2147483647"-->

</system.web>


 

 

 

 

在客户端引用的时候和以前也不太一样直接上图





 

而不是以前的直接输入地址就行了

而是MEX

秋高气爽 燃烧吧 小宇宙
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐