开发者

WCF (net.tcp) service: Works on all but one system

开发者 https://www.devze.com 2023-01-10 02:20 出处:网络
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 i

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>
    <serviceBehavi开发者_如何学Pythonors>
      <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.


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?


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

Any errors in the Event log?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号