Link to home
Start Free TrialLog in
Avatar of Silas2
Silas2

asked on

WCF Timeouts

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????
ASKER CERTIFIED SOLUTION
Avatar of Miguel Oz
Miguel Oz
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Silas2
Silas2

ASKER

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

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.
Avatar of Silas2

ASKER

The ChannelFactory's only necessary if you need multiple endpoint listeners isn't it?