0

I have created a web service using WCF REST Service Template 40(CS). When I try to consume it using

  var request = WebRequest.Create(string.Concat(serviceUrl, resourceUrl)) as HttpWebRequest;
   if (method == "POST" && requestBody != null)
            {
                byte[] requestBodyBytes = ToByteArrayUsingJsonContractSer(requestBody);
                request.ContentLength = requestBodyBytes.Length;
                using (Stream postStream = request.GetRequestStream())
                    postStream.Write(requestBodyBytes, 0, requestBodyBytes.Length);

            }

var response = request.GetResponse() as HttpWebResponse;

I keep getting:

The operation has timed out

How to increase time out ? Do I need to increase it in service or the client which is using this service with url:

http://myservice.com/RecordingCompleted/

Please suggest

DotnetSparrow
  • 27,428
  • 62
  • 183
  • 316

1 Answers1

0

try this code before Call the WEb Service.

request.Timeout = 5000;
Akshay Joy
  • 1,765
  • 1
  • 14
  • 23