Akashkumar
Akashkumar

Reputation: 69

Why can't my WCF Client connect to my WCF Service?

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>

Upvotes: 1

Views: 1810

Answers (2)

Luis Filipe
Luis Filipe

Reputation: 8708

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

Upvotes: 1

Arunkumar Ravikumar
Arunkumar Ravikumar

Reputation: 31

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

Upvotes: 0

Related Questions