2009-11-12 13 views
5

छोड़ा गया है मेरे पास एक नमूना डब्ल्यूसीएफ प्रोजेक्ट है जो मेरे वास्तविक डब्ल्यूसीएफ एप्लिकेशन के साथ एक समस्या उत्पन्न करता है। तुम मेरे नमूना WCF आवेदन hereसंचार वस्तु का उपयोग संचार के लिए नहीं किया जा सकता है क्योंकि इसे

कोड और config फाइल में समय समाप्ति सेट करने के लिए accoding के स्रोत कोड डाउनलोड कर सकते हैं, मुझे समझ नहीं आता क्या appening है:

**** Server exception : System.ServiceModel.CommunicationObjectAbortedException: 

The communication object, System.ServiceModel.Security.SecuritySessionServerSettings+SecurityReplySessionChannel, cannot be used for communication because it 
has been Aborted. 

    at System.ServiceModel.Channels.CommunicationObject.ThrowIfClosedOrNotOpen() 
    at System.ServiceModel.Security.SecuritySessionServerSettings.ServerSecuritySessionChannel.SecureApplicationMessage(Message& message, TimeSpan timeout, SecurityProtocolCorrelationState correlationState) 
    at System.ServiceModel.Security.SecuritySessionServerSettings.SecuritySessionRequestContext.OnReply(Message message, TimeSpan timeout) 
    at System.ServiceModel.Channels.RequestContextBase.Reply(Message message, TimeSpan timeout) 
    at System.ServiceModel.Channels.RequestContextBase.Reply(Message message) 
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.Reply(MessageRpc& rpc) 

**** client exception : : System.ServiceModel.Security.MessageSecurityException: An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail. ---> System.ServiceModel.FaultException: The message could not be processed. This is most likely because the action 'http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT/Cancel' is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between bindings. The security context token would be invalid if the service aborted the channel due to inactivity. To prevent the service from aborting idle sessions prematurely increase the Receive timeout on the service endpoint's binding. 
    --- End of inner exception stack trace --- 

Server stack trace: 
    at System.ServiceModel.Security.SecuritySessionClientSettings`1.ClientSecuritySessionChannel.ProcessRequestContext(RequestContext requestContext, TimeSpan timeout, SecurityProtocolCorrelationState correlationState) 
    at System.ServiceModel.Security.SecuritySessionClientSettings`1.ClientSecuritySessionChannel.ReceiveInternal(TimeSpan timeout, SecurityProtocolCorrelationState correlationState) 
    at System.ServiceModel.Security.SecuritySessionClientSettings`1.SecurityRequestSessionChannel.CloseOutputSession(TimeSpan timeout) 
    at System.ServiceModel.Security.SecuritySessionClientSettings`1.ClientSecuritySessionChannel.CloseSession(TimeSpan timeout, Boolean& wasAborted) 
    at System.ServiceModel.Security.SecuritySessionClientSettings`1.ClientSecuritySessionChannel.OnClose(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout) 
    at System.ServiceModel.Channels.ServiceChannel.OnClose(TimeSpan timeout) 
    at System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout) 

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 System.ServiceModel.ICommunicationObject.Close(TimeSpan timeout) 
    at System.ServiceModel.ClientBase`1.System.ServiceModel.ICommunicationObject.Close(TimeSpan timeout) 
    at System.ServiceModel.ClientBase`1.Close() 
    at System.ServiceModel.ClientBase`1.System.IDisposable.Dispose() 
    at WindowsFormsApplication1.Program.Main() in C:\Users\sdoucet\Documents\Visual Studio 2008\Projects\TestWCFLongExecution\WindowsFormsApplication1\Program.cs:line 25 

उत्तर

1

ऐसा लगता है कि गुजर रहे हैं ग्राहक को अपवाद वापस। डब्ल्यूसीएफ को नियमित अपवाद पसंद नहीं है, यह त्रुटियों के मामले में फाउल्स या फाल्ट अपवाद चाहता है। बाद में और अपवाद वापस कर दिया गया है, चैनल एक दोषपूर्ण स्थिति में है और फिर से उपयोग नहीं किया जा सकता है। एक FaultException के बाद चैनल अभी भी प्रयोग योग्य है।

+0

आप सही हैं, लेकिन अपवाद मेरे कोड द्वारा नहीं फेंक दिया गया है। इसे डब्ल्यूसीएफ बुनियादी ढांचे द्वारा फेंक दिया गया है। मुझे नहीं पता कि यह अपवाद क्यों फेंक दिया गया है और इससे कैसे बचें। मुझे पता है कि मेरी सेवा 10 मिनट के लिए चल रही है, लेकिन टाइमआउट सेट के अनुसार, मैं अपवाद को समझ नहीं पा रहा हूं। – Sebastien

+2

करने की पहली बात सेवा में पूर्ण ट्रेसिंग सक्षम है। यह आपको मूल समस्या के बारे में बहुत सारी जानकारी देगा। – Maurice

6

हमारे पास एक समान समस्या थी क्योंकि सेवा होस्ट करने वाले एप्लिकेशन पूल को अधिकतम कार्यकर्ता प्रक्रियाओं को 1 से अधिक करने के लिए कॉन्फ़िगर किया गया था। निरस्त करने या सफल होने के लिए बंद करने के लिए कॉल करने के लिए, इसे उसी सेवा उदाहरण में भेज दिया जाना चाहिए मूल अनुरोध

+1

इसे पोस्ट करने के लिए धन्यवाद, मेरे पास पर्यावरण के स्तर पर हमारे ग्राहकों में एक ही समस्या थी। उनके देवताओं में से एक ने 'अधिकतम कार्यकर्ता प्रक्रिया' को 5 तक सेट किया था, जिससे इन अपवादों का कारण बन गया था। हम wsfederationhttpbinding का उपयोग कर रहे थे और एक सुरक्षा टोकन सेवा (एसटीएस) भी जगह पर है, अपवाद बनाते हुए यह और भी भ्रमित हो रहा था - यह सुझाव देते हुए कि टोकन अमान्य था। वास्तव में, अनुरोध कभी-कभी गलत कार्यकर्ता प्रक्रिया के लिए निर्देशित किया जा रहा था। –

+0

हमने एक ही मुद्दा देखा और हम संदेश सुरक्षा के साथ wshttpbinding का उपयोग कर रहे थे। वेब सेवा मशीनों के सामने नेटस्काल लोड बैलेंसर होने से भी कठिन हो रहा है। हमने शुरुआत में सोचा था कि एलबी चिपचिपा सत्र बनाए रखता नहीं था, और यह देखने की कोशिश की कि एलबी को बराबर से बाहर ले जाने से समस्या हल हो जाएगी। लेकिन ऐसा नहीं हुआ जब हमने देखा कि अधिकतम कार्यकर्ता प्रक्रिया सेटिंग 1 से अधिक पर सेट की गई थी। –

2

मेरे पास एक समान समस्या थी जहां मैंने एक डब्ल्यूसीएफ सेवा एसिंक कॉल किया था। Async_completed विधि में परिणाम प्राप्त करने के बाद मुझे अपवाद मिला।

"एक अपवाद आपरेशन के दौरान हुई, परिणाम अमान्य बनाने अपवाद के लिए InnerException की जाँच करें।"

InnerException:
"संचार वस्तु संचार के लिए इस्तेमाल नहीं किया जा सकता क्योंकि यह निरस्त कर दिया गया है"

बहुत सारे प्रयासों के बाद मुझे समाधान मिल गया, बस async_completed विधि में फेंक दिए बिना अपवाद पकड़ो। (यानी कोशिश/पकड़ लागू)। मुझे समझ में नहीं आया कि सही समस्या क्या है, लेकिन किसी भी तरह संचार चैनल तोड़ रहा है।

मैं दिए गए लिंक

http://geekswithblogs.net/SoftwareDoneRight/archive/2008/05/23/clean-up-wcf-clients--the-right-way.aspx

से ऊपर approch की कोशिश की फिर भी मुझे विश्वास है कि यह सही दृष्टिकोण है नहीं कर रहा हूँ, लेकिन ऑपरेशन के परिणाम के साथ अपने परिदृश्य के अनुसार मैं कुछ भी furtherly नहीं कर रहा हूं। तो यह अपवाद पकड़ रहा है और सेवा को रोक रहा है।

संबंधित मुद्दे