Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 176883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:57:23+00:00 2026-05-11T13:57:23+00:00

I have a simple web service to allow applications to query my CMDB. The

  • 0

I have a simple web service to allow applications to query my CMDB. The function I am having trouble with works with a small resultset but fails with a larger one, indicating that it is something in the WCF service config that is preventing it succeeding.

I have a simple WinForms test app with a Service Reference to the web service and a single function that calls the function in question.

The smaller result set returns ~120KB of xml, the failing larger resultset is ~2MB. I have tried increasing the size of the maxReceivedMessageSize and maxStringContentLength without success.

Is there some config I have missed? I would be expecting a more detailed error message if that was the problem.

Thanks in advance,

Nick


The error the is returned is:

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 

The calling function in the application is:

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 

On the test rig side the app.config contains the following 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> 

and on the service side the web.config is:

  <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> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T13:57:23+00:00Added an answer on May 11, 2026 at 1:57 pm

    A collegue of mine has just pointed me at this blog post where the actual culprit is the maxItemsInObjectGraph property in the endpoint behaviours.

    Bumping these up has solved the problem, I must have just passed over the default threshold of 65536 😀

    Nice to see the error messages point you in the right direction 🙁

    Cheers….

    Also: You might get this error because one of your web methods are using class that is not a [DataContract] class.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have created a simple web service using Php Nusoap. its working correctly but
I have created just a simple web service as a console application. It works
I have a simple web service operation like this one: [WebMethod] public string HelloWorld()
Pretty simple scenario. I have a web service that receives a byte array that
I have a simple web service as below /** * Test web service */
We have a simple Web Service client caller UpdaterService (the autogenerated one, extends javax.xml.ws.Service).
I have wrote a simple web service in .NET which return a string value.
I have a simple web page that till now didn't need any login. It
I have a really simple ASP.NET web application and a web setup project that
I have a simple ASP.NET 3.5 SP1 Web Forms app... I've added the System.Web.Routing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.