Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. The operation has timed out when using web services

The operation has timed out when using web services

Scheduled Pinned Locked Moved C#
csharpwcfsysadminjson
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gbabu17
    wrote on last edited by
    #1

    I am using a .net console apllication(C#) which makes API calls to a web service. There is a large amount of data transfer. The exception i am getting is "The operation has timed out". I generated stub classes from WDL files and using them in client application. Where can i set the timeout value. Is it on the client application or on the web server. and what parameters are used to set the time out value. thanks

    R 1 Reply Last reply
    0
    • G gbabu17

      I am using a .net console apllication(C#) which makes API calls to a web service. There is a large amount of data transfer. The exception i am getting is "The operation has timed out". I generated stub classes from WDL files and using them in client application. Where can i set the timeout value. Is it on the client application or on the web server. and what parameters are used to set the time out value. thanks

      R Offline
      R Offline
      Ravi Bhavnani
      wrote on last edited by
      #2

      There are 2 types of timeouts that you can specify on the client side when making a call to a web service: send and receive. If you're expecting to send a large amount of data, increase the send timeout; if you're expecting to receive a large amount of data, increase the receive timeout. You can of course specify both or none. The timeouts are properties of the binding. Here's an example of how to specify them.

      // Create service proxy
      string url = "http://localhost:1234/MyService";
      EndpointAddress address = new EndpointAddress (url);
      WSHttpBinding binding = new WSHttpBinding();
      binding.SendTimeout = ...;
      binding.ReceiveTimeout = ...;
      ChannelFactory cf =
      new ChannelFactory(binding, address);
      IMyService svcProxy = cf.CreateChannel();

      // Call method
      svcProxy.MyMethod();

      Hope this helps! /ravi

      This is your brain on Celcius Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com

      G 1 Reply Last reply
      0
      • R Ravi Bhavnani

        There are 2 types of timeouts that you can specify on the client side when making a call to a web service: send and receive. If you're expecting to send a large amount of data, increase the send timeout; if you're expecting to receive a large amount of data, increase the receive timeout. You can of course specify both or none. The timeouts are properties of the binding. Here's an example of how to specify them.

        // Create service proxy
        string url = "http://localhost:1234/MyService";
        EndpointAddress address = new EndpointAddress (url);
        WSHttpBinding binding = new WSHttpBinding();
        binding.SendTimeout = ...;
        binding.ReceiveTimeout = ...;
        ChannelFactory cf =
        new ChannelFactory(binding, address);
        IMyService svcProxy = cf.CreateChannel();

        // Call method
        svcProxy.MyMethod();

        Hope this helps! /ravi

        This is your brain on Celcius Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com

        G Offline
        G Offline
        gbabu17
        wrote on last edited by
        #3

        Thanks for the fast reply. It seems system.servicemodel is supported by only .Net framework 3.0, but i am using 2.0. so are there any equivalent methods in 2.0

        R 1 Reply Last reply
        0
        • G gbabu17

          Thanks for the fast reply. It seems system.servicemodel is supported by only .Net framework 3.0, but i am using 2.0. so are there any equivalent methods in 2.0

          R Offline
          R Offline
          Ravi Bhavnani
          wrote on last edited by
          #4

          Sorry, I (incorrectly) assumed you were using WCF. /ravi

          This is your brain on Celcius Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups