4
當一個人撥打打開方法IRequestChannel究竟發生了什麼?舉例來說,如果我有以下代碼:WCF RequestChannel;什麼真的發生?
ChannelFactory<IRequestChannel> factory = new ChannelFactory<IRequestChannel>();
// using a netTcpBinding to a net.tcp://localhost:9999/Bar
IRequestChannel outchannel = factory.CreateChannel();
outchannel.Open(); // what happens here?
if (outchannel.State == CommunicationState.Opened)
{
success = true;
}
outchannel.Close();
我似乎獲得與他人準確失敗的一些服務「誤報」。如果這不會以某種方式確認頻道是開放的,我會假設我總會得到誤報。
任何有關改進的建議?我想避免發送消息,因爲這只是爲了測試服務的診斷測試的可行性,但如果這是必要的,我可以。
我從我們的配置文件中注意到,返回誤報的信道使用以下behaviorConfiguration:
<binding name="secureNetTcpStream" maxBufferSize="2000000" maxReceivedMessageSize="2000000000" transferMode="Streamed" sendTimeout="00:05:00" receiveTimeout="14:00:00">
<readerQuotas maxStringContentLength="2000000000" maxArrayLength="2000000000" />
<security mode="TransportWithMessageCredential">
<message clientCredentialType="UserName" />
</security>
</binding>
我不知道流行爲的配置是什麼導致了IRequestChannel顯示它是開放的即使主機和服務不可用?