2009-04-03 8 views
7

मेरी एक सरल वेब सेवा है जो अनुप्रयोगों को मेरे सीएमडीबी से पूछताछ करने की अनुमति देती है। फ़ंक्शन में मुझे एक छोटे से परिणाम के साथ काम करने में परेशानी हो रही है लेकिन एक बड़े से विफल रहता है, यह दर्शाता है कि यह डब्ल्यूसीएफ सेवा कॉन्फ़िगरेशन में कुछ है जो इसे सफल होने से रोक रहा है।डब्ल्यूसीएफ त्रुटि संदेश को समझ नहीं सकता है, मदद

मेरे पास वेब सेवा के लिए एक सेवा संदर्भ के साथ एक सरल WinForms परीक्षण ऐप है और एक ऐसा फ़ंक्शन जो फ़ंक्शन को प्रश्न में कॉल करता है।

छोटे परिणाम सेट ~ 120 केबी एक्सएमएल लौटाता है, असफल बड़ा परिणाम ~ 2 एमबी है। मैंने सफलता के बिना maxReceivedMessageSize और maxStringContentLength के आकार को बढ़ाने का प्रयास किया है।

क्या कोई कॉन्फ़िगरेशन मैंने याद किया है? अगर यह समस्या थी तो मुझे एक और विस्तृत त्रुटि संदेश की उम्मीद होगी।

अग्रिम धन्यवाद,

निक


दिया जाता है है त्रुटि:

System.ServiceModel.CommunicationException: The underlying connection was closed: The connection was closed unexpectedly. ---> 
System.Net.WebException: The underlying connection was closed: The connection was closed unexpectedly. 
    at System.Net.HttpWebRequest.GetResponse() 
    at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) 
    --- End of inner exception 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.Channels.ClientReliableChannelBinder`1.RequestClientReliableChannelBinder`1.OnRequest(TRequestChannel channel, Message message, TimeSpan timeout, MaskingMode maskingMode) 
    at System.ServiceModel.Channels.ClientReliableChannelBinder`1.Request(Message message, TimeSpan timeout, MaskingMode maskingMode) 
    at System.ServiceModel.Channels.ClientReliableChannelBinder`1.Request(Message message, TimeSpan timeout) 
    at System.ServiceModel.Security.SecuritySessionClientSettings`1.SecurityRequestSessionChannel.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 TestRig.CmdbDataService.ICmdbDataService.GetMonitors(String client) 
    at TestRig.CmdbDataService.CmdbDataServiceClient.GetMonitors(String client) in C:\Documents and Settings\nfoster\My Documents\Visual Studio Projects\Virtual Operations Manuals\Trunk\src\TestRig\Service References\CmdbDataService\Reference.vb:line 1480 
    at TestRig.Form1.btnGetServers_Click(Object sender, EventArgs e) in C:\Apps\Virtual Operations Manuals\Trunk\src\TestRig\Form1.vb:line 8 

आवेदन में बुला समारोह है:

Private Sub btnGetMonitors_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGetMonitors.Click 
    txtResults.Text = String.Empty 
    Dim proxy As CmdbDataService.CmdbDataServiceClient = Nothing 
    Try 
    proxy = New CmdbDataService.CmdbDataServiceClient("WSHttpBinding_ICmdbDataService") 
    Dim monitors As TestRig.CmdbDataService.ConfigurationItems = proxy.GetMonitors(txtClientName.Text) 
    proxy.Close() 
    For Each monitor In monitors 
     txtResults.Text &= monitor.Name & " (" & monitor.TypeName & ")" & vbCrLf 
    Next 
    txtResults.Text &= monitors.Count & " monitors returned" 
    Catch ex As Exception 
    If Not IsNothing(proxy) AndAlso proxy.State <> ServiceModel.CommunicationState.Closed Then proxy.Abort() 
    txtResults.Text = ex.ToString 
    Finally 
    proxy = Nothing 
    End Try 
End Sub 

पर टी स्था रिग पक्ष app.config निम्नलिखित ServiceModel शामिल हैं:

<system.serviceModel> 
    <diagnostics> 
     <messageLogging logMalformedMessages="true" logMessagesAtServiceLevel="true" 
     logMessagesAtTransportLevel="true" /> 
    </diagnostics> 
    <behaviors /> 
    <bindings> 
     <wsHttpBinding> 
     <binding name="WSHttpBinding_Default" closeTimeout="00:05:00" 
      openTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:05:00" 
      maxBufferPoolSize="104857600" maxReceivedMessageSize="104857600"> 
      <readerQuotas maxDepth="104857600" maxStringContentLength="104857600" 
      maxArrayLength="104857600" maxBytesPerRead="104857600" maxNameTableCharCount="104857600" /> 
     </binding> 
     </wsHttpBinding> 
    </bindings> 
    <client> 
     <endpoint address="http://localhost/CmdbServices/DataService.svc/soap12" 
     binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_Default" 
     contract="CmdbDataService.ICmdbDataService" name="WSHttpBinding_ICmdbDataService"> 
     <identity> 
      <userPrincipalName value="MyMachine\ASPNET" /> 
     </identity> 
     </endpoint> 
    </client> 
    </system.serviceModel> 

और सेवा की ओर web.config है:

<system.serviceModel> 
    <diagnostics performanceCounters="Default"> 
     <messageLogging logMalformedMessages="true" logMessagesAtServiceLevel="true" 
     logMessagesAtTransportLevel="true" /> 
    </diagnostics> 
    <services> 
     <service behaviorConfiguration="ServiceBehavior" name="MyCorp.Cmdb.Services.DataService.CmdbDataService"> 
     <endpoint address="soap12" binding="wsHttpBinding" contract="MyCorp.Cmdb.Services.DataService.ICmdbDataService" /> 
     <endpoint address="soap11" binding="basicHttpBinding" contract="MyCorp.Cmdb.Services.DataService.ICmdbDataService" /> 
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="ServiceBehavior"> 
      <serviceMetadata httpGetEnabled="true"/> 
      <serviceDebug includeExceptionDetailInFaults="true"/> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    </system.serviceModel> 
+0

मैं टाइमआउट मूल्यों में वृद्धि की कोशिश करेंगे। –

उत्तर

15

मेरा एक कॉलेग्यू ने मुझे this blog post पर इंगित किया है जहां वास्तविक अपराधी एंडपॉइंट व्यवहार में maxItemsInObjectGraph संपत्ति है।

इन को bumping समस्या को हल किया है, मैं सिर्फ 65536 के डिफ़ॉल्ट सीमा से अधिक बीत चुके हैं चाहिए: डी

देखने के लिए त्रुटि संदेश सही दिशा :(

चीयर्स में आप बात अच्छा .. ..

इसके अलावा:। क्योंकि अपने वेब तरीकों में से एक वर्ग है कि एक [DataContract] वर्ग नहीं है का उपयोग कर रहे तो आपको यह त्रुटि मिल सकता है

+0

ब्लॉग पोस्ट का वेब आर्काइव: http://web.archive.org/web/20071013175610/http://blogs।conchango.com:80/merrickchaffer/archive/2007/09/19/WCF-System.Net.WebException_3A00_-The-underlying-connection-was-closed_3A00_-The-connection-was-closed-unexpectedly.aspx –

0

UPDATED: ठीक है, मुझे लगता है कि आप पहले से ही tracing है चालू । क्या आपने डब्ल्यूसीएफ निशान देखा है?

+0

मैंने निशानों को देखा था लेकिन मुझे लगता है कि उन्हें डीकोड करना वाकई मुश्किल है, डब्ल्यूसीएफ मेरा प्राथमिक क्षेत्र नहीं है। अपवाद को वहां सूचीबद्ध किया गया है लेकिन विवरण मूल अपवाद में बिल्कुल हैं :( – Nick

0

कोशिश क्लाइंट पक्ष कोड में इस पकड़ को जोड़ने के लिए:

catch (CommunicationException commProblem) 
{ 
    Console.WriteLine("There was a communication problem. " + commProblem.Message + commProblem.StackTrace); 
    Console.Read(); 

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