开发者

WCF Self Hosting timeout

开发者 https://www.devze.com 2023-03-19 07:48 出处:网络
I have a Unity based C# WPF application that has a Module that communicates to a WCF based project within the same solution.

I have a Unity based C# WPF application that has a Module that communicates to a WCF based project within the same solution.

The WCF dll works if i use the WCF test host make it an active service, but times out if i try to create a ServiceHost from code.

here is the code that is in the Unity Modules Initialization()

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

Here is my app.config section

  <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 turned off "start WCF Service Host when debugging " from the wcf project properties setting.

So, the above configuration seems to load ok from the wcf trace file, but when i go to use any of the services, i get a timeout without any information that i can see that lets me know what is causing the timeout.

here is the error message from the wcf trace, prior to this exception message, all the messages seem to succeed. The HTTP request to 'http://localhost:8080/AtomCfgModelService' has exceeded the allotted timeout of 00:00:59.9840000. The time allotted to this operation may have been a portion of a longer timeout.

What is confusing is that 开发者_如何学Cif i use the WCF test host, then the above configuration works

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

The above code running the wcfsvchost.exe uses the same config ( and WCF dll ) and i dont get the timeout.

Any points on how to debug/fix this would great.

0

精彩评论

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

关注公众号