我正在學習WCF並開發了一個服務,首先使用wsHttpBinding
並將其託管在IIS7(win7)上,並從Windows客戶端應用程序使用該服務。它工作正常(使用WCF服務DLL方法)有兩個端點的問題:wsHttpBinding和netTCPBinding
我試圖有兩個端點,並添加netTCpBinding
。我遇到一個錯誤
{該TransportManager失敗使用 NetTcpPortSharing服務所提供的URI聽:無法啓動服務,因爲它是 禁用。
我已經開始所需的服務,甚至重新啓動我的機器。在「服務」中,2個服務顯示爲自己啓動..我已經在IIS中啓用了所需的tcpnetbinding設置,並由許多博客和msdn通知。
我的客戶端應用程序的配置是這樣的:
<configuration>
<system.serviceModel>
<bindings />
<client>
<endpoint name="httpEndpoint"
address="http://MachineName:8000/FLOW5WCFService.svc"
binding="wsHttpBinding"
contract="FLOW5ServiceDLL.IFLOW5WCFService"/>
<endpoint name="tcpEndpoint"
address="net.tcp://MachineName:8082/FLOW5WCFService.svc"
binding="netTcpBinding"
contract="FLOW5ServiceDLL.IFLOW5WCFService"/>
</client>
</system.serviceModel>
</configuration>
服務web.config
:
<configuration>
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="tcpBinding"
portSharingEnabled="true"
closeTimeout="00:10:00" openTimeout="00:10:00"
receiveTimeout="00:10:00" sendTimeout="00:10:00" transactionFlow="true"
hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288"
maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="4096"
maxNameTableCharCount="320000" />
</binding>
</netTcpBinding>
</bindings>
<services>
<service behaviorConfiguration="FLOW5ServiceDLL.FLOW5WCFServiceBehaviour"
name="FLOW5ServiceDLL.FLOW5WCFService">
<endpoint
address=""
binding="wsHttpBinding"
contract="FLOW5ServiceDLL.IFLOW5WCFService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint
binding="netTcpBinding"
bindingConfiguration="tcpBinding"
contract="FLOW5ServiceDLL.IFLOW5WCFService"/>
<endpoint
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8000/" />
<add baseAddress="net.tcp://localhost:8082" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="FLOW5ServiceDLL.FLOW5WCFServiceBehaviour">
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<system.web>
<compilation debug="false" />
</system.web>
</configuration>
我創建一個頻道在我的客戶端代碼如下
ChannelFactory<IFLOW5WCFService> protocolFactory
= new ChannelFactory<IFLOW5WCFService>("tcpEndpoint");
l_oFLOW5Service = protocolFactory.CreateChannel();
任何人都可以請讓我知道如果我的配置錯誤或者是我需要做的任何其他設置?請讓我知道的情況下,任何更多的信息,需要提前
沒有人需要更多信息嗎?沒有答案!! ..請讓我知道,如果有人發現了更多的事情要做.. – srivatsayb