0

同じソリューション内のWCFベースのプロジェクトと通信するモジュールを持つUnityベースのC#WPFアプリケーションがあります。

WCFテストホストを使用してアクティブなサービスにするとWCFdllは機能しますが、コードからServiceHostを作成しようとするとタイムアウトになります。

これがUnityModulesInitialization()にあるコードです

host = new ServiceHost(typeof(AtomCfgModelClient));
host.Open();

これが私のapp.configセクションです

  <endpoint address="http://localhost:8080/AtomCfgModelService"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IAtomCfgModel"
contract="AtomCfgModel.IAtomCfgModel" name="WSHttpBinding_IAtomCfgModel">
    <identity>
      <dns value="localhost" />
    </identity>
  </endpoint>
</client>

<services>
  <service name="AtomCfgModule.AtomCfgModel.AtomCfgModelClient" >
    <endpoint   address="" binding="wsHttpBinding" contract="AtomCfgModel.IAtomCfgModel"    >
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint name="mex" address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:8080/AtomCfgModelService" />
      </baseAddresses>
    </host>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior >
      <serviceMetadata httpGetEnabled="True" />
      <serviceDebug includeExceptionDetailInFaults="False" />
    </behavior>
  </serviceBehaviors>
</behaviors>

iveは、wcfプロジェクトのプロパティ設定から「デバッグ時にWCFサービスホストを開始する」をオフにしました。

したがって、上記の構成はwcfトレースファイルから正常に読み込まれるようですが、いずれかのサービスを使用すると、タイムアウトの原因を知ることができる情報がなくてもタイムアウトが発生します。

これがwcfトレースからのエラーメッセージです。この例外メッセージの前に、すべてのメッセージが成功したようです。'http:// localhost:8080 / AtomCfgModelService'へのHTTPリクエストが、割り当てられたタイムアウト00:00:59.9840000を超えました。この操作に割り当てられた時間は、より長いタイムアウトの一部であった可能性があります。

紛らわしいのは、WCFテストホストを使用する場合、上記の構成が機能することです

                            String arg = "/service:\"" + Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "AtomCfgModel.dll") + "\" /config:\"" + Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "GISShell.exe.config") + "\"";
                            System.Diagnostics.Process.Start(@"c:\WcfSvcHost.exe", arg);

wcfsvchost.exeを実行している上記のコードは、同じ構成(およびWCF dll)を使用しており、タイムアウトが発生しません。

これをデバッグ/修正する方法に関するポイントは素晴らしいでしょう。

4

0 に答える 0