Solved

WCF Timeouts

Posted on 2013-07-01
4
445 Views
Last Modified: 2013-08-27
I can't understand it, I'm working on a VS 2010 project with WCF service. I've got a code binding object in the client end:
 binding.ReceiveTimeout = new System.TimeSpan(0, 30, 0);
.SendTimeout = new System.TimeSpan(0, 30, 0);

Open in new window

and the web.config in the server end:
<basicHttpBinding>
          <binding   transferMode="Streamed" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"  name="myServericeName"  receiveTimeout="0:30:00" sendTimeout="00:30:00">

Open in new window

and yet it still times out after 20seconds????
0
Comment
Question by:Silas2
  • 2
  • 2
4 Comments
 
LVL 35

Accepted Solution

by:
Miguel Oz earned 250 total points
ID: 39353258
Can you post the complete client code as well as WCF server and client web.config?
It seems that you are changing your value elsewhere as the default value is 10 minutes.
0
 

Author Comment

by:Silas2
ID: 39354608
public static  VTeamLinkServiceClient GetClient()
        {
            System.ServiceModel.BasicHttpBinding binding = new BasicHttpBinding();
            binding.MaxReceivedMessageSize = 2147483647;
            binding.TransferMode = TransferMode.StreamedResponse;
            binding.ReceiveTimeout = new System.TimeSpan(0, 30, 0);
            binding.SendTimeout = new System.TimeSpan(0, 30, 0);
            binding.Security.Mode = System.ServiceModel.BasicHttpSecurityMode.None;

            string whichWCF = "zRemote";
            string wcfAddress = "";

            if (whichWCF == "Remote")
            {
                wcfAddress = "http://xxxx/vteamlinkservice.svc/BasicBind";
            }
            else
            {
                wcfAddress = "http://127.0.0.1.:50719/VTeamLinkService.svc/BasicBind";
            }

            EndpointAddress address =
               new EndpointAddress(wcfAddress);

            VTeamLinkServiceClient svc = new VTeamLinkServiceClient(binding, address);
            return svc;
        }

Open in new window


 <system.serviceModel>
   
      <services>
          <service name="VTeamLinkWCFService.VTeamLinkService">
              <endpoint address="/BasicBind" binding="basicHttpBinding" bindingConfiguration="VTeamLinkWCFService.VTeamLinkService.customBinding0"
                  contract="VTeamLinkServiceContracts.IVTeamLinkService" />
          </service>
          <service name="VTeamLinkWCFService.VTeamLinkServiceUtils1">
              <endpoint address="" behaviorConfiguration="VTeamLinkWCFService.VTeamLinkServiceUtils1AspNetAjaxBehavior"
                  binding="webHttpBinding" contract="VTeamLinkWCFService.VTeamLinkServiceUtils1" />
          </service>
      </services>
      <bindings>
        <basicHttpBinding>
          <binding   transferMode="Streamed" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"  name="VTeamLinkWCFService.VTeamLinkService.customBinding0"  receiveTimeout="00:30:00" sendTimeout="00:30:00">
            <security mode="None"/>
            <readerQuotas
              maxDepth="32"
              maxStringContentLength="2147483647"
              maxArrayLength="2147483647"
              maxBytesPerRead="4096"
              maxNameTableCharCount="16384" />
          </binding>
        </basicHttpBinding>
        <wsHttpBinding>
          <binding     maxReceivedMessageSize="2147483647"   name="VTeamLinkWCFService.VTeamLinkService.customBinding2"  receiveTimeout="10:10:00" sendTimeout="10:10:00">
            <security mode="None"/>
          </binding>
        </wsHttpBinding>
  
      </bindings>
      <behaviors>
          <endpointBehaviors>
              <behavior name="VTeamLinkWCFService.VTeamLinkServiceUtils1AspNetAjaxBehavior">
                  <enableWebScript />
              </behavior>
          </endpointBehaviors>
          <serviceBehaviors>
              <behavior name="">
                  <serviceAuthorization principalPermissionMode="None" />
                  <serviceMetadata httpGetEnabled="true" />
                  <serviceDebug includeExceptionDetailInFaults="true" />
              </behavior>
          </serviceBehaviors>
      </behaviors>
      <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
          multipleSiteBindingsEnabled="true" />
    </system.serviceModel>

Open in new window

0
 
LVL 35

Expert Comment

by:Miguel Oz
ID: 39356405
There is no client config file, I assume that you are setting client in code
In WCF, you must use ChannelFactory to create your client instance as described below:
http://stackoverflow.com/questions/2943148/how-to-programmatically-connect-a-client-to-a-wcf-service
http://msdn.microsoft.com/en-us/library/ms734681(v=vs.100).aspx

Also notice that you are missing the readerQuotas in your client code, check:
http://stackoverflow.com/questions/969479/modify-endpoint-readerquotas-programatically

Note: Your code must define all configuration values defined on the server.
0
 

Author Comment

by:Silas2
ID: 39357439
The ChannelFactory's only necessary if you need multiple endpoint listeners isn't it?
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

This tutorial will show you how to add an attribute to an XML (http://en.wikipedia.org/wiki/XML) stream returned from a Windows Communication Foundation (http://en.wikipedia.org/wiki/Windows_Communication_Foundation) (WCF) Web Service.  Some knowled…
While working on Silverlight and WCF application, I faced one issue where fault exception occurred at WCF operation contract is not getting propagated to Silverlight client. So after searching net I came to know that it was behavior by default for s…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now