Windows Service Hosted TCP WCF

I am trying to host a WCF service on a Windows 2008 R2 server as a Windows service. I followed the directions provided by msdn ( found here ). Everything works fine, as long as everything is part of the same solution in the visual studio. However, I tried to create the client in another solution (on the same computer) and it cannot find the service. I get the "Add link service error" shown below.

enter image description here

My goal is to have access to the wcf service remotely, but I cannot even access it locally if the client was not created in the same client. Are there any guides, tutorials, or helpful tips anyone can give me to get this to work?

Update: , Windows , WCF, , . , . , , . , , Windows , WCF . , Visual Studio WCF , .

, Windows WCF? ?

+3
4

, , MSDN (. ). Windows, WCF Service1, .

Windows WCF, , .

myServiceHost = new ServiceHost(typeof(Service1));

, WCF, Windows.

myServiceHost = new ServiceHost(typeof(WcfServiceLibrary1.Service1));

, , , Visual Studio , , WCF , .

, Visual Studio , , Espen Burud.

+6

, :

Discover: .
Go: "" .

, Go.

, URL- net.tcp. , http MEX. app.config :

<services>
  <service behaviorConfiguration="WcfServiceLibrary1.Service1Behavior"
    name="WcfServiceLibrary1.Service1">
    <endpoint address="" binding="netTcpBinding" bindingConfiguration=""
      contract="WcfServiceLibrary1.IService1">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexTcpBinding" bindingConfiguration=""
      contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="net.tcp://localhost:8523/Service1" />
        <add baseAddress="http://localhost:8524/Service1" />
      </baseAddresses>
    </host>
  </service>
</services>

http. "http://localhost: 8524/Service1" " ". -.

http GET (, ), :

<behaviors>
  <serviceBehaviors>
    <behavior>
      <serviceMetadata httpGetEnabled="True"/>
    </behavior>
  </serviceBehaviors>
</behaviors>

, Add Service Reference.

HTTP- (httpGetEnabled = "False" ), , MEX ( ).

+3

MSDN , . , , .

, tcp, : netstat -a. , :

Proto  Local Address          Foreign Address        State
TCP    0.0.0.0:8523           machinename:0          LISTENING
+2

I managed to find out this problem. My service did not know about the endpoints because I did not copy the service configuration from app.config in the WCF project to app.config of the actual Windows service. As soon as I did this, it functioned correctly.

In the original MSDN article, which I also talked about, this was not clear, although it is mentioned in a comment in WCF app.config.

0
source

All Articles