1

I have developed a WCF service, but I'm having issues connecting to it from my client.

I'm able to see the service's wsdl in the browser, but when I try to connect service by WCF Client I get this error message:

The open operation did not complete within the allotted timeout of 00:23:59.5339734. The time allotted to this operation may have been a portion of a longer timeout.

the following is the my client app.config details:-

 <system.serviceModel>
<bindings>
  <wsDualHttpBinding>
    <binding name="WSDualHttpBinding_IService" closeTimeout="00:25:00" openTimeout="00:24:00" receiveTimeout="00:15:00" sendTimeout="00:25:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="409600" maxNameTableCharCount="16384"/>
      <reliableSession ordered="true" inactivityTimeout="00:25:00"/>
      <security mode="None">
        <!--<message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default"/>-->
      </security>
    </binding>
  </wsDualHttpBinding>
</bindings>
<client>
  <endpoint address="http://silcore.co.in/Service.svc" 
                  binding="wsDualHttpBinding"
                  bindingConfiguration="WSDualHttpBinding_IService" 
                  contract="IService" 
                  name="WSDualHttpBinding_IService">
    <identity>
      <dns value="http://silcore.co.in"/>
    </identity>
  </endpoint>
</client>

Here's the stacktrace for the timeout error:

at System.ServiceModel.Channels.ReliableRequestor.ThrowTimeoutException()
at System.ServiceModel.Channels.ReliableRequestor.Request(TimeSpan timeout)
  at System.ServiceModel.Channels.ClientReliableSession.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.ClientReliableDuplexSessionChannel.OnOpen(TimeSpan timeout)

at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)

Exception rethrown at [0]: 
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,   IMessage retMsg)
 at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
 at System.ServiceModel.ICommunicationObject.Open(TimeSpan timeout)
 at   System.ServiceModel.ClientBase`1.System.ServiceModel.ICommunicationObject.Open(TimeSpan timeout)
 at System.ServiceModel.ClientBase`1.Open()
 at WCF_Client.Program.Main(String[] args)

Server side web.congif file

    <?xml version="1.0"?>
<configuration>

<system.web>
 <compilation targetFramework="4.0" defaultLanguage="c#" />
 <customErrors mode="Off" />
</system.web>
<system.webServer>
  <defaultDocument>
    <files>
      <add value="Service.svc" />
  </files>
</defaultDocument>
</system.webServer>
<system.serviceModel>
<bindings>
  <wsDualHttpBinding>
    <binding name="DualNewBinding" />
  </wsDualHttpBinding>
</bindings>
<services>
  <service behaviorConfiguration="HostWCF.ServiceBehavior" name="HostWCF.Service">
    <endpoint address="" binding="wsDualHttpBinding" bindingConfiguration="DualNewBinding" contract="HostWCF.IService">
      <identity>
        <dns value="silcore.co.in" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="http://silcore.co.in/" />
      </baseAddresses>
    </host>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="HostWCF.ServiceBehavior">
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
</configuration>
Akashkumar
  • 69
  • 1
  • 9
  • Try to increase all the timeouts noticeably. Also, do you use a firewall? – athabaska Jan 22 '14 at 11:38
  • Is that the _only_ error you get? When does the error occur, when you execute a resource-heavy, time-consuming method, or also for a `void Test()` method? – CodeCaster Jan 22 '14 at 11:45
  • I had already increased the time by 24 min and still getting error, @ athabaska. @CodeCaster I'm not using any heavy resource. Guys other than this what can i do? – Akashkumar Jan 22 '14 at 11:51
  • You can start by adding more details and look into the details of what is happening, there is no silver bullet for this. First, show the **full exception**. Then [enable tracing](http://stackoverflow.com/questions/4271517/how-to-turn-on-wcf-tracing) for client and server, to see where the requests end up. Does the service work on your development machine? Does it work if you add and call a test method that actually doesn't do anything? – CodeCaster Jan 22 '14 at 11:55
  • I had tried by hosting in localhost and it was successful, but when i move to server then this problem coming. – Akashkumar Jan 22 '14 at 11:57
  • Also show us your relevant server configuration – Luis Filipe Jan 22 '14 at 12:39
  • Now server giving 404 error – Akashkumar Jan 28 '14 at 10:23

2 Answers2

1

I'd say the operation behind the service is really taking a long time. Is it expected to take more that 24 minutes? If so, increase the timeout or, perhaps, you should make that operation Async.

If 24 minutes is no way the expected, try to change the operation to return immediately. Does it work now? If yes then it's your operation that is taking a long time and you need to find out how and why.

If not, you might be with firewall/network issues. The server or someone in the middle might not be refusing your connection but just ignoring it. To debug this try to deactivate the security for the moment. Also, make sure whether the request is received on the server side. Put a breakpoint or log any incoming requests.

Hope it helped out

Luis Filipe
  • 8,488
  • 7
  • 48
  • 76
0

I think you need to increase the value of OpenTimeOut in your client configuration.

Check weather any firewall Is blocking the call on the server

Also I feel that some kind of logging or network monitoring tool at server side would also help you out

NetMon is a nice tool from Microsoft. try that