1

私はWindowsサービス内にWCFサービスを作成しましたが、何らかの理由でサービスを多数のシステム(OSと構成はほぼ同じ)に展開しましたが、1つを除いてすべてで機能します。サーバ。すべてのデプロイメントの構成は、サービスのベースアドレスを除いて同じです。

サービスを開始すると、を開いても例外は発生しません。ServiceHost使用netstat -anpすると、サービスのプロセスによってソケットが開かれたことがわかります。ドロップされたパケットのWindowsファイアウォールログを設定しましたが、ログファイルは空のままです。

WCFテストクライアントからWCFサービスにアクセスしようとすると、次のメッセージが表示されます。

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.

WCFログを試しましたが、ログファイルが作成されません。

サービスの構成は次のとおりです。

<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>

なぜそれが機能しないのかについては何の兆候もないので、私はちょっと迷っています。どんな助けでもいただければ幸いです。

4

2 に答える 2

0

デプロイしているサーバーでも、ポート9100で何かが実行されていますか?

サービスが見つからないようです。ベースアドレスを変更してみましたか?

通常、サーバーシステムにデプロイし、サーバーシステムで機能しない場合は、マシンの構成です。確認します

  • .NETバージョン
  • このマシンにファイアウォールが設定されていないことを確認してください。
  • バインドしているポートが開いていることを確認してください。この場合は9100
  • 必要に応じて、サードパーティの.dllがGACまたはフォルダに含まれていることを確認してください。
  • すべての.dllとコードが最新であることを確認します。

「net.tcp:// myhostname:9001/SysMonitorAgent」というエラーメッセージが表示されます

ホスト名を使用するのではなく、マシンのIPアドレスに置き換えようとしましたか?

于 2010-07-30T15:25:51.147 に答える
0

Davidの指摘に加えて、Windowsサービスが実行されていることを確認してください。

イベントログにエラーはありますか?

于 2010-07-30T16:34:47.530 に答える