none
WCF Service Size Limit?

    Question

  •  I have a Webservice like this:
            [OperationContract]
    public string CreateDeepZoomMosaic(List<FlickrSearchHit> images)
    {
    String processID = Communication.generateUID();
    startBatchDelegat sbd = new startBatchDelegat(Communication.startBatch);
    string path = HttpContext.Current.Server.MapPath("MosaicFolder");
    IAsyncResult tag = sbd.BeginInvoke(processID, images,path, null, null);
    return processID;
    }

     and calling it from the Sl-client Async.This works fine until the List pararmeter succseeds a amount of entries(around 400).

    if it does , the Service emidietly return an error: "NotFound" ( not even accessing the first line of the Service Code)

    Is there a SizeLimit of an pararmeter, ore an timeout I´m not aware of?

    Thanks in advance ...

     

     

    Text of the uncaught Exeption:

     System.ServiceModel.CommunicationException was unhandled by user code
      Message="The remote server returned an error: NotFound"
      StackTrace:
           bei System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
           bei System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
           bei System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
           bei System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)
           bei MosaicGenerator.MosaicService.MosaicServiceClient.MosaicServiceClientChannel.EndCreateDeepZoomMosaic(IAsyncResult result)
           bei MosaicGenerator.MosaicService.MosaicServiceClient.MosaicGenerator.MosaicService.MosaicService.EndCreateDeepZoomMosaic(IAsyncResult result)
           bei MosaicGenerator.MosaicService.MosaicServiceClient.OnEndCreateDeepZoomMosaic(IAsyncResult result)
           bei System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)
      InnerException: System.Net.WebException
           Message="The remote server returned an error: NotFound"
           StackTrace:
                bei System.Net.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
                bei System.Net.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
                bei System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
           InnerException: System.Net.WebException
                Message="The remote server returned an error: NotFound"
                StackTrace:
                     bei System.Net.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
                     bei System.Net.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
                     bei System.Net.AsyncHelper.<>c__DisplayClass2.<BeginOnUI>b__0(Object sendState)
                InnerException:


     

    Wednesday, October 22, 2008 7:38 AM

Answers

  •  pfff Finaly got it!

    There are two places you have to edit:

    1. edit the ServiceReferences.ClientConfig to accept a large buffer.

     <binding name="BasicHttpBinding_MosaicService" maxBufferSize="2147483647"
                        maxReceivedMessageSize="2147483647"> 

    2. on the server in the web.config

     <system.serviceModel>

    add a Httpbinding and name it

    <bindings>
         <basicHttpBinding>
           <binding name="ServicesBinding" maxReceivedMessageSize="2000000" maxBufferSize="2000000">
             <readerQuotas maxArrayLength="2000000" maxStringContentLength="2000000"/>
        </binding>

     

    which setts it to 2MB and  tell the service to use this binding

     <system.serviceModel>

        <services>

             <service behaviorConfiguration="TekPlayground.MosaicServiceBehavior"
        name="TekPlayground.MosaicService">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="ServicesBinding" contract="TekPlayground.MosaicService" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
       </service>

     

     

    And you are ready to go Big Smile

     

    Wednesday, October 22, 2008 7:46 PM
  •  Thanks for the article link, it was really great. Turns out this is the reason why it fails:

    "The reason none of this works in the Silverlight world is because [Silverlight] has absolutely no concept of a fault.  It actually can't.  With this specific service, when your service call fails validation, your Silverlight application will only see a 404 error with the text "The remote server returned an error: NotFound".  When a fault is thrown, regardless of how pretty you make it, the HTTP status code is not 200, where 200 means that everything went OK.  This is a problem for Silverlight."

    The article provides a solution where you modify the web service, but as I'm consuming a third-party Java Web Service, that is not an option. At least now I know that the problem is not solveable in SL, so I can look into other solutions.

     

    Thursday, February 19, 2009 4:40 AM

All replies

  • Have you tried changing the binding/@maxBufferSize in the ServiceReference.ClientConfig, by default is set to 64kb?

    Wednesday, October 22, 2008 8:24 AM
  •  Good Gues , but unfortunatly not the reason.

    Was already set to MaxInt.

    I tried a Loop, rashes at 277 items, lowerer the Buffersize to 65000 , run again an still a crash at 277.

     Any other suggestion where this can be handled?

    Wednesday, October 22, 2008 9:05 AM
  • I also use the following statement when I want to revieve larger amounts of data:

    binding.MaxReceivedMessageSize = 2000000

    I use this in the constructor of the object I am creating.

    Wednesday, October 22, 2008 1:55 PM
  • Try profiling the web service call with Web Developer Helper to see what is going on (or Filddler):

    http://projects.nikhilk.net/WebDevHelper/

    I also had problems in Beta 2 where setting the stuff in code didn't work.  I had to set them in the xml config settings.

    Wednesday, October 22, 2008 3:30 PM
  •  MaxReceivedMessageSize must be the same than MAxbuffersize, else it hrows an exeption.

    Can you be a bit more specific, when you are constructing  the Serviceclient? And Where do I tell the service to use the Clientconfigfile in the first place?

    Wednesday, October 22, 2008 3:36 PM
  • I meet this problem too. how about it now?

    Wednesday, October 22, 2008 7:27 PM
  •  pfff Finaly got it!

    There are two places you have to edit:

    1. edit the ServiceReferences.ClientConfig to accept a large buffer.

     <binding name="BasicHttpBinding_MosaicService" maxBufferSize="2147483647"
                        maxReceivedMessageSize="2147483647"> 

    2. on the server in the web.config

     <system.serviceModel>

    add a Httpbinding and name it

    <bindings>
         <basicHttpBinding>
           <binding name="ServicesBinding" maxReceivedMessageSize="2000000" maxBufferSize="2000000">
             <readerQuotas maxArrayLength="2000000" maxStringContentLength="2000000"/>
        </binding>

     

    which setts it to 2MB and  tell the service to use this binding

     <system.serviceModel>

        <services>

             <service behaviorConfiguration="TekPlayground.MosaicServiceBehavior"
        name="TekPlayground.MosaicService">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="ServicesBinding" contract="TekPlayground.MosaicService" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
       </service>

     

     

    And you are ready to go Big Smile

     

    Wednesday, October 22, 2008 7:46 PM
  • even after doing what you suggested its still giving me same error, i spent whole day and i am unable to find out what the hell is its problem. I am trying to run it inside my visualstudio, other 2 methods for same webservice run fine, and this 3rd method giving me this error, really strange to me :(

    any help will be highly appreciated

    Tuesday, February 10, 2009 12:42 PM
  • I get the same error too. I call a web service to authenticate a user. If the authentication details are correct, everything works fine, however, if the password is incorrect, I get this exception. In other words, same method fails with different parameters. My http binding looks ok for the maxBufferSize and the maxReceivedMessageSize (both set to 2147483647). It's a https web service, and security mode is set to "Transport":

                    <binding name="IdentityServicesImplPortBinding" maxBufferSize="2147483647"
                        maxReceivedMessageSize="2147483647">
                        <security mode="Transport" />
                    </binding>
     

    Wednesday, February 18, 2009 10:25 AM
  •  

    Sorry to hear this,creating Service references automaticly is is a quick and dirty solution. A pitty but a fact. All I can say is that you might have a look at this article which is a real timesaver for working with wcf
    Wednesday, February 18, 2009 12:25 PM
  •  Thanks for the article link, it was really great. Turns out this is the reason why it fails:

    "The reason none of this works in the Silverlight world is because [Silverlight] has absolutely no concept of a fault.  It actually can't.  With this specific service, when your service call fails validation, your Silverlight application will only see a 404 error with the text "The remote server returned an error: NotFound".  When a fault is thrown, regardless of how pretty you make it, the HTTP status code is not 200, where 200 means that everything went OK.  This is a problem for Silverlight."

    The article provides a solution where you modify the web service, but as I'm consuming a third-party Java Web Service, that is not an option. At least now I know that the problem is not solveable in SL, so I can look into other solutions.

     

    Thursday, February 19, 2009 4:40 AM
  • I have a silverlight application that access a simple web service, the application succeeds to get data from webservice, when it posts data to webservice the following exception occurs, I have set all client access policy... Nothing changed I am downloading fiddler to try to figure it out... Any help 

    The remote server returned an error: NotFound.


    System.ServiceModel.CommunicationException was unhandled by user code
      Message=The remote server returned an error: NotFound.
      StackTrace:
           at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
           at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
           at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)

           at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)
      InnerException: System.Net.WebException
           Message=The remote server returned an error: NotFound.
           StackTrace:
                at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
                at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
                at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
           InnerException: System.Net.WebException
                Message=The remote server returned an error: NotFound.
                StackTrace:
                     at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
                     at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
                     at System.Net.Browser.AsyncHelper.<>c__DisplayClass2.<BeginOnUI>b__0(Object sendState)
                InnerException:


     

    Tuesday, July 27, 2010 2:11 AM
  • Hi Lars,


    Nicely explained,

    Thanks a Lot ...! Struggled 2 days to solve this issue.


    Thanks & Regards

    Deepak Koduri




    Friday, February 11, 2011 3:12 AM
  • I have set everything to Max size, even then I am getting the error.

     <bindings>
          <basicHttpBinding>
            <binding name="Bind" closeTimeout="01:10:00" openTimeout="01:10:00"
             receiveTimeout="01:20:00" sendTimeout="00:30:00" bypassProxyOnLocal="false"
             hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647"
             maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
             messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
             useDefaultWebProxy="true">
              <readerQuotas maxDepth="64" maxStringContentLength="2147483647"
               maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
            </binding>
          </basicHttpBinding>
          <customBinding>
          </customBinding>
        </bindings>

    -------------

     <binding name="BasicHttpBindingService" maxBufferSize="2147483647"
                        maxReceivedMessageSize="2147483647">
                        <security mode="None" />
                    </binding>
     

     

    Any help

    Thanks in Advance

    Tuesday, September 25, 2012 8:28 AM