2012-12-26 27 views
5

Trong mã của tôi, tôi yêu cầu WCF gửi đến điểm cuối https://. Đôi khi máy chủ WCF sẽ không thể kết nối với bất kỳ lý do gì và sau đó mã của tôi sẽ mang lại và ngoại lệ:Tại sao tôi nhận được ngoại lệ với "dấu vết ngăn xếp máy chủ" khi máy khách không thể kết nối với máy chủ WCF?

System.TimeoutException 
The request channel timed out while waiting for a reply after 00:01:00. 
Increase the timeout value passed to the call to Request or increase 
the SendTimeout value on the Binding. The time allotted to this operation 
may have been a portion of a longer timeout. 

.StackTrace của ngoại lệ chứa các văn bản sau đây:

Server stack trace: <<<< THE QUESTION IS ABOUT THIS VERY LINE 
    at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) 
    at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) 
    at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) 
    at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) 

Exception rethrown at [0]: 
    at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) 
    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) 
    at [my code here invoking an OperatiionContract-attributed method 

.InnerExceptionTimeoutException khác với thông báo sau:

The HTTP request to 'https://management.core.windows.net/subscription-id-here/ 
    services/hostedservices/service-name-here/deployments/deployment-id-here' 
has exceeded the allotted timeout of 00:01:00. The time allotted to this 
operation may have been a portion of a longer timeout. 

Điều tôi không nhận được là đoạn mã Server stack trace.

Tại sao lại là "máy chủ" nếu yêu cầu của tôi thậm chí không được máy chủ trả lời?

+1

Bạn có chắc chắn rằng yêu cầu của khách hàng không đạt đến WCF serivce? Có lẽ có một số ngoại lệ về dịch vụ – sll

+0

Thử tăng bất kỳ thời gian chờ nào cho '1: 00' và xem liệu nó có hoạt động tốt hơn hay không. –

+0

@John Saunders: Giống như tôi sẽ nhận được ngoại lệ không đề cập đến "theo dõi máy chủ"? – sharptooth

Trả lời

0

Thời gian chờ có thể xảy ra ở cả hai bên của kết nối; khách hàng hoặc máy chủ. Do đó dựa trên ngoại lệ của bạn, tôi sẽ nói rằng khách hàng kết nối với máy chủ nhưng vì một phản ứng không được tạo ra trong thời gian (dựa trên các ràng buộc của máy chủ cho sendTimeout), WCF trả lời như bạn đã thấy.

Xem http://msdn.microsoft.com/en-us/library/hh924831(v=vs.110).aspx để biết thêm thông tin về cài đặt thời gian chờ.

Các vấn đề liên quan