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

  • SEARCH
  • Home
  • 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 6685549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:04:13+00:00 2026-05-26T05:04:13+00:00

I have an ASP.NET 4.0 Application. A webservice is hosted using a .svc file

  • 0

I have an ASP.NET 4.0 Application.

A webservice is hosted using a .svc file linking a source (service implementation).
The web service .svc file is located inside a directory WebServs in the application root directory: MyApp/WebServs/mysvc.svc.

The web service is set using the Web.config (in the root directory).

<!-- Service model -->
<system.serviceModel>
  <services>
    <service name="DataAccessService">
      <endpoint address=""
                binding="basicHttpBinding"
                bindingConfiguration="basicHttpBinding_ISRV"
                contract="MyNamespace.ISRV">
      </endpoint>
    </service>
  </services>

  <bindings>
    <basicHttpBinding>
      <binding name="basicHttpBinding_ISRV" maxReceivedMessageSize="2147483647">
        <readerQuotas maxStringContentLength="1310720" 
                      maxArrayLength="16384" 
                      maxBytesPerRead="24096" 
                      maxDepth="10000" 
                      maxNameTableCharCount="16384"/>
      </binding>
    </basicHttpBinding>
  </bindings>
  <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>

OK!

When I call the web service, I create the channel using a routine in order to encapsulate this commonly used logic:

public static ISRV GetService() {
  try {
    // Create the service endpoint
    BasicHttpBinding bhttpb = new BasicHttpBinding(
      BasicHttpSecurityMode.TransportCredentialOnly);
    bhttpb.MaxReceivedMessageSize = 2147483647;
    bhttpb.ReaderQuotas = new System.Xml.XmlDictionaryReaderQuotas();
    bhttpb.ReaderQuotas.MaxArrayLength = 16384);
    bhttpb.ReaderQuotas.MaxBytesPerRead = 24096);
    bhttpb.ReaderQuotas.MaxDepth = 10000);
    bhttpb.ReaderQuotas.MaxNameTableCharCount = 16384);
    bhttpb.ReaderQuotas.MaxStringContentLength = 1310720);

    ServiceEndpoint httpEndpoint =
      new ServiceEndpoint(
        ContractDescription.GetContract(typeof(ISRV)),
        bhttpb,
        new EndpointAddress());

    // Create channel factory and get proper channel for service.
    ChannelFactory<ISRV> channelFactory = new ChannelFactory<ISRV>(httpEndpoint);

    IDAS svc = channelFactory.CreateChannel();

    return svc;
  } catch (Exception e) {
    throw new DASException("DAS Exception: " + e.Message);
  }
}

This routine is called by clients. Whilke the Web.config is used to configure the service server side.

When I try to execute my service with large messages (with tiny messages all’s right) I get:

The formatter threw an exception while trying to deserialize the
message: There was an error while trying to deserialize parameter
http://((Namespace)):((Operation)). The InnerException message
was ‘There was an error deserializing the object of type
((Type)),
App_Code.s5qoir2n, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null]]. The maximum string content length quota (8192)
has been exceeded while reading XML data. This quota may be increased
by changing the MaxStringContentLength property on the
XmlDictionaryReaderQuotas object used when creating the XML reader.
Line 31, position 1309.’. Please see InnerException for more details.

Don’t understand. Both service and client have common settings, and this reads defaut values????? Furthermore I did as many other users did following instructions here in StackOverflow.

Please help me. Thankyou

  • 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. Editorial Team
    Editorial Team
    2026-05-26T05:04:13+00:00Added an answer on May 26, 2026 at 5:04 am

    You specified WCF 4.0 (well, ASP.NET 4.0 to be exact), so I wonder if the problem you’re encountering is that you’re actually hitting a default endpoint, which would use the default values for the binding unless otherwise overridden?

    WCF 4.0 will supply a default endpoint (set to where the service is located at). That default endpoint will most likely use the default values for the binding (8192 in the case of the MaxStringContentLength).

    Since you do all the configuration for the service in the directory above the WebServs directory (the root), perhaps it’s resorting to a default endpoint? I do realize that the Web.config files will inherit from the ones above, but this is something to at least consider, if you haven’t already.

    More info on default endpoints and other changes for 4.0 can be found here: A Developer’s Introduction to Windows Communication Foundation 4

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

Sidebar

Related Questions

I have an ASP.net web service that I'm using for a web application which
We have an ASMX web service which we invoke from our ASP.NET application using
I am trying to call a web service from asp.net 3.5 application. I have
I have to consume a .NET hosted web service from a Java application. Interoperability
How to call WebService (using AJAX) if I created ASP.NET Web Application template. Every
I have an ASP.NET 2.0 web service and am using it in (among other
I have an ASP.NET web application. It has a web service, with several web
I have a control application - using asp.net webservices. I have a timer which
I have an asp.net mvc 2 web application that connects to a WCF web
We have a legacy ASP.NET web site (not web application, so I can freely

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.