[英]WCF error “no endpoint listening” with named pipes
我正在使用 WCF 和 .NET 3.5 我正在使用命名管道但不斷收到錯誤
在 net.pipe://localhost/Test 上沒有可以接受消息的端點監聽。 這通常是由不正確的地址或 SOAP 操作引起的。
我按照教程http://www.switchonthecode.com/tutorials/wcf-tutorial-basic-interprocess-communication但問題仍然存在。 客戶端和服務器上的端點是相同的(我檢查了拼寫等)。 該項目沒有配置文件,但配置在代碼中。
編輯:代碼(客戶端):
ChannelFactory<ITest> pipeFactory =
new ChannelFactory<ITest>(
new NetNamedPipeBinding(),
new EndpointAddress(
"net.pipe://localhost/test"));
ITest test= pipeFactory.CreateChannel();
test.doStuff();
服務器:
serviceHost = new ServiceHost(typeof(Test), new Uri("net.pipe://localhost"));
serviceHost.AddServiceEndpoint(typeof(ITest), new NetNamedPipeBinding(), "test");
File.Create(@"C:\test.txt");
serviceHost.Open();
謝謝
在服務器端創建 ServiceHost 實例時不要包含基地址。 相反,在添加服務端點時提供完全限定的端點地址:
serviceHost = new ServiceHost(typeof(Test));
serviceHost.AddServiceEndpoint(typeof(ITest), new NetNamedPipeBinding(), new EndpointAddress("net.pipe://localhost/test"));
File.Create(@"C:\\test.txt");
serviceHost.Open();
這可能是:
Another possibility to fix this root issue if you are getting an error that no net.pipe address can be found at your url (ie http://localhost:1234/MyService/etc/
) is to make sure that the Net.Pipe Listener Adapter
Windows 服務啟動。 (我也啟動了 Net.Tcp Listener Adapter)
在某些情況下,該服務似乎沒有啟用或啟動,尤其是在部署到可能沒有安裝大量積極使用這些服務的開發工具的遠程服務器時。 啟動服務解決了這個問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.