我试图在Win7中用IIS 7.5创建WCF NamedPipe。在Win7 IIS 7.5上托管NamedPipe WCF EndpointNotFoundException
- 在IIS管理器中右击,并创建一个名为 “TestWCFWithNamedPipe”
网页右键点击我的网站 “TestWCFWithNamedPipe” - >选择编辑绑定
Type:http Host Name:sample.localdev.net Port:80 Address:* Type:net.pipe Binding informations:*
在高级设置中设定的值启用议定书 “HTTP,net.pipe”
- 在我的网站 “TestWCFWithNamedPipe” Web应用程序项目
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
错误消息?
您设置的网站在IIS sample.localdev.net。你不应该用那个地址吗? – Szymon
我使用net.pipe模式,是net.pipe需要“sample.localdev.net”地址吗? 所以我应该使用“net.pipe://sample.localdev.net/Sample”?我试过了,错了! – Flash
我会放弃它。 – Szymon