Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

WCF Timeouts

Posted on 2013-07-01
4
Medium Priority
?
481 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 36

Accepted Solution

by:
Miguel Oz earned 1000 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 36

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

773 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