简体   繁体   English

WCF REST服务中的操作已超时

[英]The operation has timed out in WCF REST Service

I have created a web service using WCF REST Service Template 40(CS) . 我已经使用WCF REST服务模板40(CS)创建了一个Web服务。 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: 我是否需要在服务中或通过url使用此服务的客户端中增加它:

http://myservice.com/RecordingCompleted/ http://myservice.com/RecordingCompleted/

Please suggest 请建议

在致电Web服务之前,请尝试此代码。

request.Timeout = 5000;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM