locked
newbie to wcf services using netNamedPipeBinding and the service doesn't start RRS feed

  • Question

  • Hi All,

    I am a newbie to WCF services and trying to create a simple wcf service with netnamedpipebinding. When I try to start the service using the wcftestclient, keep getting this error 

    Creating a simple WCF service, that I do not want to host in IIS (since the application is a purely windows based app that needs to be hosted on the local server and should not be available over web/browsers) just created a simple service.

    Error: Cannot obtain Metadata from net.pipe://configurationservice/ If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error URI: net.pipe://configurationservice/ Metadata contains a reference that cannot be resolved: 'net.pipe://configurationservice/'. There was no endpoint listening at net.pipe://configurationservice/ that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. The pipe endpoint 'net.pipe://configurationservice/' could not be found on your local machine.

    Not sure how to get rid of this - Looked over lot of already published websites and still cannot make it work.

    Here is my web.config file

    <?xml version="1.0"?>
    <configuration>
      <appSettings>
        <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
      </appSettings>
      <system.web>
        <compilation debug="true" targetFramework="4.7.2" />
        <httpRuntime targetFramework="4.7.2"/>
      </system.web>
       <system.webServer>
        <modules runAllManagedModulesForAllRequests="true"/>
        <!--
            To browse web app root directory during debugging, set the value below to true.
            Set to false before deployment to avoid disclosing web app folder information.
          -->
        <directoryBrowse enabled="true"/>
      </system.webServer>

      <system.serviceModel>
        <behaviors>
          <serviceBehaviors>
            <behavior name="ConfigSvcBehavior">
              <serviceDebug />
              <serviceMetadata />
              <serviceTimeouts />
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <services>
          <service behaviorConfiguration="ConfigSvcBehavior" name="ConfigurationWCFService.WCFService">
            <endpoint address="" binding="netNamedPipeBinding" bindingConfiguration=""
              name="ConfigSvcNetNamedPipeEndPoint" contract="ConfigurationWCFService.IConfigData" />
            <endpoint address="mex" binding="mexNamedPipeBinding" bindingConfiguration=""
              name="ConfigSvcMexNamedPipeEndPoint" contract="IMetadataExchange" />
            <host>
              <baseAddresses>
                <add baseAddress="net.pipe://ConfigurationService" />
              </baseAddresses>
            </host>
          </service>
        </services>
      </system.serviceModel>
    </configuration>

    Any help is appreciated.


    • Edited by RajHW Tuesday, October 20, 2020 8:09 AM
    Tuesday, October 20, 2020 8:06 AM

All replies

  • This is because if you use NetNamedPipeBinding you need to publish metadata on the http endpoint, here is a demo:

    <system.serviceModel>
    		<behaviors>
    			<serviceBehaviors>
    				<behavior name="ConfigSvcBehavior">
    					<serviceDebug />
    					<serviceMetadata httpGetEnabled="true"/>
    				</behavior>
    			</serviceBehaviors>
    		</behaviors>
    		<services>
    			<service behaviorConfiguration="ConfigSvcBehavior" name="ConsoleApp89.CalculatorService">
    				<endpoint address="net.pipe://localhost/uesamples/calc" binding="netNamedPipeBinding" bindingConfiguration=""
    				  name="ConfigSvcNetNamedPipeEndPoint" contract="ConsoleApp89.ICalculator" />
    				<host>
    					<baseAddresses>
    						<add baseAddress="http://localhost:8000/uesamples/service" />
    					</baseAddresses>
    				</host>
    			</service>
    		</services>
    	</system.serviceModel>

    The base address of this service is http, but there is an endpoint that uses netNamedPipeBinding. We can call the endpoint of netNamedPipeBinding by accessing the metadata of the base address.

    For more information about netNamedPipeBinding, you can refer to this link:

    https://docs.microsoft.com/en-us/dotnet/api/system.servicemodel.netnamedpipebinding?view=netframework-4.8

    Wednesday, October 21, 2020 5:47 AM