[英]Hosting NamedPipe WCF on Win7 IIS 7.5 EndpointNotFoundException
我正在嘗試使用IIS 7.5在win7中創建WCF NamedPipe。
右鍵單擊我的網站“ TestWCFWithNamedPipe”->選擇“編輯綁定”
Type:http Host Name:sample.localdev.net Port:80 Address:* Type:net.pipe Binding informations:*
在“高級”設置中,將“啟用的協議”的值設置為“ http,net.pipe”
web.config
:
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="DefaultBehavior">
<serviceDebug />
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="DefaultBehavior" name="SampleWcfLib.SampleWcfObj">
<endpoint address="net.pipe://localhost/Sample" binding="netNamedPipeBinding"
bindingConfiguration="" contract="SampleWcfInterfaceLib.ISampleWcfObj" />
</service>
</services>
</system.serviceModel>
下面是TestClient.exe
代碼
string address = "net.pipe://localhost/Sample";
NetNamedPipeBinding binding = new NetNamedPipeBinding();
EndpointAddress ep = new EndpointAddress(address);
ISampleWcfObj channel = ChannelFactory<ISampleWcfObj>.CreateChannel(binding, ep);
string result = channel.Ping("Test");
我運行TestClient.exe
,但出現異常:
在net.pipe:// localhost / Sample上沒有偵聽終結點的端點可以接受該消息。 這通常是由不正確的地址或SOAP操作引起的。 有關更多詳細信息,請參見InnerException(如果存在)。
我已經檢查了Win7服務狀態:
Net.Pipe Listener Adapter Started
Net.Tcp Listener Adapter Started
我已經完成了WCF的所有設置。
為什么我仍然收到EndpointNotFoundException
錯誤消息?
如果您查看XSD文件,則可以找到tcp綁定的名稱。 它會在文件的底部,看起來像這樣
<wsdl:service name="PersonService">
<wsdl:port name="NetNamedPipeBinding_IPersonContract" binding="tns:NetNamedPipeBinding_IPersonContract">
<soap12:address location="net.pipe://wcftestpipe/WcfTest/PersonService.svc/test"/>
<wsa10:EndpointReference>
<wsa10:Address>net.pipe://wcftestpipe/WcfTest/PersonService.svc/test</wsa10:Address>
</wsa10:EndpointReference>
</wsdl:port>
</wsdl:service>
另外,如果您適當地獲得了安全意識,那么就會表明您沒有正確的憑據。 您可以在WCF服務的web.config和客戶端的app.config中將綁定安全模式設置為NONE。
<bindings>
<netNamedPipeBinding>
<binding>
<security mode="None"/>
</binding>
</netNamedPipeBinding>
</bindings>
希望這可以幫助
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.