2009-08-25 16 views
8

मैं एक WCF वेब सेवा स्थानीय रूप से बोल रहा हूँ (या दूरस्थ) है कि छोटे (डेटा ईए की < 1K के बारे में 25 लाइनों) डेटा की मात्रा के साथ ठीक काम कर रहा से प्राप्त करें। लेकिन जब डेटा बड़ा हो जाता है (लगभग 300 लाइनें) वेब सेवा विफल हो जाती है। नीचे अपवाद से अपवाद, आंतरिक अपवाद, और स्टैक ट्रेस है।WCF वेब सेवा विफल पर बड़ा डेटा

सेवा भी असामान्य रूप से स्थानीय स्तर पर निष्पादित करने के लिए लंबे समय से लग रहा है (मैं इस ऐड क्योंकि यह आपको सुलझाने में कुछ संकेत दे सकते हैं)। बड़ी मात्रा में डेटा प्राप्त करना 3 एस सर्वर-साइड लेता है और डेटा के बारे में छोटा 1s सर्वर-साइड लेता है। हालांकि, डेटा की थोड़ी सी मात्रा प्राप्त करने के लिए वेब सेवा (स्थानीय रूप से) चलाना 24s लेता है।

मेरे पास भी में मेरे क्लाइंट परीक्षण एप्लिकेशन से app.config से बाध्यकारी जानकारी शामिल है।

========= बाध्यकारी जानकारी ===========

<system.serviceModel> 
    <bindings> 
    <basicHttpBinding> 
     <binding name="BasicHttpBinding_IFormsService" closeTimeout="00:01:00" 
      openTimeout="00:01:00" receiveTimeout="02:00:00" sendTimeout="00:02:00" 
      allowCookies="false" bypassProxyOnLocal="false" 
      hostNameComparisonMode="StrongWildcard" 
      maxBufferSize="2147483647" maxBufferPoolSize="2147483647" 
      maxReceivedMessageSize="2147483647" 
      messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" 
      useDefaultWebProxy="true"> 
     <readerQuotas maxDepth="32" maxStringContentLength="1000000000" 
         maxArrayLength="1000000000" 
         maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
     <security mode="None"> 
      <transport clientCredentialType="None" 
         proxyCredentialType="None" realm="" /> 
      <message clientCredentialType="UserName" algorithmSuite="Default" /> 
     </security> 
    </binding> 
    </basicHttpBinding> 
</bindings> 
<client> 
    <endpoint 
     address="http://monica-pc/TrialIQSvc/FormsService.svc/FormsService/FormsService.Svc" 
     binding="basicHttpBinding" 
     bindingConfiguration="BasicHttpBinding_IFormsService" 
     contract="WebService.IFormsService" name="BasicHttpBinding_IFormsService" /> 
</client> 

========= अपवाद आंकड़े =============

**Exception**: An error occurred while receiving the HTTP response to http://monica-pc/TrialIQSvc/FormsService.svc/FormsService/FormsService.Svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details. 

**Inner Exception**: The underlying connection was closed: An unexpected error occurred on a receive. 
    **Stack trace**: 
Server stack trace: 
    at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason) 
    at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) 
    at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) 
    at System.ServiceModel.Dispatcher.RequestChannelBinder.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.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs) 
    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 Test.WebService.IFormsService.GetFormGroupInstance(String formGroupId, String subjectId, String userId) 
    at Test.WebService.FormsServiceClient.GetFormGroupInstance(String formGroupId, String subjectId, String userId) in G:\SVNTrialIQ\trunk\Common\trunk\source\Forms\Test\Service References\WebService\Reference.cs:line 59 
    at Test.Form1.btnInstanceInfo_Click(Object sender, EventArgs e) in G:\SVNTrialIQ\trunk\Common\trunk\source\Forms\Test\Form1.cs:line 408 

उत्तर

2

त्रुटि जानकारी SvcTraceViewer उपयोग करने का प्रयास करने के लिए बढ़ाया।

+0

यूप! उसने ऐसा किया मैं अपने देव मशीन (Vista) पर प्रकट होने के लिए एक ट्रेस लॉग नहीं मिला। लेकिन, जब मैं विस्टा के साथ प्रदान किए गए आईआईएस 7 इंटरफ़ेस को देखता हूं, तो मुझे यह मानना ​​है कि यह मुझे महसूस करता है जैसे मैंने अपने जीवन में पहले कभी कंप्यूटर को छुआ नहीं। इसलिए मैंने बहुत अधिक समस्या निवारण नहीं किया। –

+0

हालांकि, मेरे Win2003 सर्वर पर web.config में ट्रेस कोड चलाने से पता चला कि यह विरासत के कारण एक प्रकार त्रुटि थी, जो कि असंबंधित है, लेकिन यहां अच्छी तरह से वर्णन किया गया है: http://developers.de/blogs/damir_dobric/archive/200 9/03/24/about-quot-knowntypeattribute-quot-example.aspx –

0

हो सकता है कि आप वहाँ कोई बात बिगड़ जाए सकता है कि की एक संख्या है सर्वर साइड

2

पर कुछ विन्यास याद कर रहे हैं।

सबसे पहले, जैसा कि "डारिन" पहले ही सुझाया गया है - संदेश ट्रेसिंग को चालू करने का प्रयास करें और देखें कि यह क्या उत्पादन करता है।

दूसरा - अगर आप एक समय समाप्ति में चल जा सकता है। आपने कहा कि आपके छोटे डेटा सेट को वापस करने में लगभग 24 सेकंड लग गए हैं, आपका बड़ा डेटा सेट 12 गुना बड़ा (300 बनाम 25 लाइन) है, ताकि 288 सेकंड लग सकें - लेकिन आपका sendTimeout 2 मिनट तक सेट हो गया है - ताकि हो सकता है कारण। बढ़ रही है के 10 मिनट का कहना है कि यह बताने के लिए कि सेट करने का प्रयास - कि पर्याप्त समय होना चाहिए:

<binding name="BasicHttpBinding_IFormsService" 
      sendTimeout="00:10:00" 

हैं कि यह समाधान नहीं करता है - आप डेटा की बड़ी मात्रा वापस ले जाने के में स्ट्रीमिंग का उपयोग करने की कोशिश कर सकते:

<binding name="BasicHttpBinding_IFormsService" 
     transferMode="StreamedResponse"> 

जब तक यह केवल अपनी प्रतिक्रियाओं कि बड़े हैं के रूप में, कि काम करना चाहिए। बेशक, आपको स्ट्रीमिंग को संभालने के लिए सेवा को थोड़ा सा कॉल करने के लिए अपने क्लाइंट को फिर से शुरू करना होगा (एक ऑपरेशन अनुबंध = सेवा विधि बनाएं जो Stream को इसके रिटर्न वैल्यू के रूप में लौटाती है, और सर्वर से भाग में डेटा पढ़ने के लिए स्ट्रीम का उपयोग करें) । यदि यह आपके लिए एक आम परिदृश्य है, तो यह काम कर सकता है और प्रयास के लायक हो सकता है (और यह आपको बड़े संदेशों के साथ बाढ़ से इनकार करने के लिए सेवा हमले से बचने के लिए फिर से अपने बफर आकार को कम करने की अनुमति देगा)।

स्ट्रीमिंग बारे में अधिक जानकारी के लिए एक महान intro to WCF message streaming देखें।

और अगर कुछ भी नहीं मदद करता है - वापस आओ और हमें बताएं!system.web खंड में में :

मार्क

+0

मैं स्ट्रीमिंग आलेख को देखता हूं। महान संदर्भ! प्रदर्शन ट्यूनिंग मेरा अगला कदम है। –

0

इस प्रयास करें। MaxRequestLength विशेषता सेट करें।

<httpRuntime executionTimeout="90" maxRequestLength="1048576" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100"/> 
0

यह त्रुटि अनुबंध विसंगति के कारण हो सकती है। नीचे दिए गए तीन स्तरित आवेदनों पर विचार करें ...

UI Layer        
    |  
Process Layer 
    | 
Data Access Layer     
-> Contract Between Process and UI layer has the same enum with missing (Onhold = 3). Enum: Start = 1, Stop = 2. 
-> Contract Between Data Access And Process layer has enum Enum: Start = 1,Stop = 2,Onhold = 3. 

इस मामले में हमें प्रक्रिया परत प्रतिक्रिया में एक ही त्रुटि मिल जाएगी।

एक ही त्रुटि बहुआयामी अनुप्रयोग में अन्य अनुबंध विसंगति में आता है।