Consume WCF hosted in a Windows Service from a ASP.NET application RRS feed

  • Question

  • User-2066177896 posted


    I created a WCF service and hosted it in a Windows Service. I installed the windows Service using InstallUtil on my local PC.

    If i have to comnsume it from a web application how do iadd the reference? How can i consume this service?


    When i try to add service reference :   net.tcp://localhost:8731/Design_Time_Addresses/WCFJobsLibrary/Jobs

    I get the following errors:

    Metadata contains a reference that cannot be resolved: 'net.tcp://localhost:8731/Design_Time_Addresses/WCFJobsLibrary/Jobs/'.
    Could not connect to net.tcp://localhost:8731/Design_Time_Addresses/WCFJobsLibrary/Jobs/. The connection attempt lasted for a time span of 00:00:02.0010000. TCP error code 10061: No connection could be made because the target machine actively refused it
    No connection could be made because the target machine actively refused it
    If the service is defined in the current solution, try building the solution and adding the service reference again.


          <service behaviorConfiguration="WCFJobsLibrary.JobsBehavior"
            <endpoint address="" binding="netTcpBinding" bindingConfiguration=""
                <dns value="localhost" />
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
                <add baseAddress="net.tcp://localhost:8731/Design_Time_Addresses/WCFJobsLibrary/Jobs/" />
            <behavior name="WCFJobsLibrary.JobsBehavior">
              <serviceMetadata httpGetEnabled="false" />
              <serviceDebug includeExceptionDetailInFaults="false" />

    Friday, October 18, 2013 9:37 AM


  • User503812343 posted

    you are using mexHttpBinding, for netTcpBinding you have to use mexTcpBinding. Make sure you install your Windows Service with Administrative rights.

    for more details on hosting wcf service in windows service

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, October 18, 2013 11:17 AM