简体   繁体   中英

Hosting NamedPipe WCF on Win7 IIS 7.5 EndpointNotFoundException

I am trying to create WCF NamedPipe in win7 with IIS 7.5.

  1. In IIS Manager right click, and create WebSite named "TestWCFWithNamedPipe"
  2. Right click my WebSite "TestWCFWithNamedPipe" -> select Edit bindings

     Type:http Host Name:sample.localdev.net Port:80 Address:* Type:net.pipe Binding informations:* 
  3. In Advanced settings set the value for Enabled Protocol as "http,net.pipe"

  4. In My WebSite "TestWCFWithNamedPipe" Web Application Project

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 code is following

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");

And I run TestClient.exe , and I get an exception:

There was no endpoint listening at net.pipe://localhost/Sample that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

I have checked Win7 Service status:

Net.Pipe Listener Adapter   Started
Net.Tcp Listener Adapter    Started

I have done all settings for WCF.

Why do I still get the EndpointNotFoundException error message ?

You can find the name of your tcp binding if you have a look in your XSD file. It will be on the bottom of your file and it will look like this

<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>

Afther that you propably get a security exeception that will say you don't have the right credentials. You can set your binding security mode to NONE in your web.config of your WCF service and app.config of your Client.

<bindings>
    <netNamedPipeBinding>
      <binding>
        <security mode="None"/>
      </binding>
    </netNamedPipeBinding>
</bindings>

Hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM