views:

108

answers:

2

I've written created a WCF service inside a Windows service, and for some reason I can't figure out, I deployed the service on a bunch of systems (all nearly identical in OS and configuration), and it works on all but one server. The configuration for all deployments is identical except for the service's base address.

When the service is started, I get no exception when I open the ServiceHost, and when using netstat -anp I can see the socket has been opened by the service's process. I've set up Windows firewall logging for dropped packets, but the log file remains empty.

If I try accessing the WCF service from WCF Test Client, I get the following message:

Error: Cannot obtain Metadata from net.tcp://myhostname:9001/SysMonitorAgent 
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.tcp://myhostname:9001/SysMonitorAgent    
    Metadata contains a reference that cannot be resolved: 'net.tcp://myhostname:9001/SysMonitorAgent'.
    There was no endpoint listening at net.tcp://myhostname:9001/SysMonitorAgent that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

I've tried WCF logging, but the log file does not even get created.

The config for the service is as follows:

<system.serviceModel>
  <diagnostics>
    <messageLogging logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" />
  </diagnostics>
  <bindings>
    <netTcpBinding>
      <binding name="InterfaceServiceNetTcpBinding">
        <security mode="None">
          <transport clientCredentialType="None" protectionLevel="None" />
          <message clientCredentialType="None" />
        </security>
      </binding>
    </netTcpBinding>
  </bindings>
  <behaviors>
    <serviceBehaviors>
      <behavior name="InterfaceServiceBehavior">
        <serviceMetadata httpGetEnabled="false" />
        <serviceDebug httpHelpPageEnabled="false" httpsHelpPageEnabled="false" includeExceptionDetailInFaults="false" />
      </behavior>
    </serviceBehaviors>
  </behaviors>
  <services>
    <service name="SysMonitor.Agent.Interface.InterfaceService" behaviorConfiguration="InterfaceServiceBehavior">
      <endpoint address="" binding="netTcpBinding" bindingConfiguration="InterfaceServiceNetTcpBinding" contract="SysMonitor.Agent.Interface.IInterfaceService">
        <identity>
          <dns value="localhost" />
        </identity>
      </endpoint>
      <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
      <host>
        <baseAddresses>
          <add baseAddress="net.tcp://myhostname:9001/SysMonitorAgent" />
        </baseAddresses>
      </host>
    </service>
  </services>
</system.serviceModel>

I'm kinda lost, because there is NO indication whatsoever as to why it's not working. Any help would be appreciated.

A: 

On the server you are deploying too is something running on port 9100?

It seems like it can not find the service. Have you tried changing the base address?

Typical if you deploy it on serval systems and it doesn't work on one it is configuration of the machine. I would check

  • .NET Versions
  • Make sure no Firewalls are set up on this machine preventing the binding
  • Check the port you are binding is open in this case 9100
  • Make sure any 3rd party .dll are included in the GAC or folder if needed.
  • Verify all the .dll and your code is up to date.

I see the error message says "net.tcp://myhostname:9001/SysMonitorAgent "

Did you try to replace it with the machine IP Address rather than using the host name?

David Basarab
I've checked that the port is only used by the correct process. .NET is version 4, installed on all machines. 3rd party DLLs are not used. The only firewall is Windows Firewall which has an exception for the TCP port used. All deployments were done from the same .msi, and the files are identical.
ErikHeemskerk
Fixed, and it was a stupid mistake on my part. I tried changing the port, and then I noticed when running `netstat -ano` that the port hadn't changed. Then I noticed I had been editing the wrong config file. Thanks for the pointer!
ErikHeemskerk
A: 

In addition to David's points, check that the windows service is running.

Any errors in the Event log?

Shiraz Bhaiji
The service is running, and other than 'the service has started' there is nothing in the Event Viewer.
ErikHeemskerk