Freigeben über


SYSK 377: System.ServiceModel.CommunicationException in a Silverlight 4.0 app

All the credit for the information in this post goes to Marc DeAntoni, and other Internet posts/articles that helped Marc get to the root cause!

 

On my current project, we were working on a proof of concept application measuring how many editable rows x columns we can display using Silverlight 4.0, Telerik’s RadGridView control and using RIA services for data access. All was Ok, until we hit about 1500 rows (60 columns), at which point we got the following exception:

 

{System.ServiceModel.CommunicationException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound.

   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)

   --- End of inner exception stack trace ---

   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)

   --- End of inner exception stack trace ---

   at System.ServiceModel.Channels.Remoting.RealProxy.Invoke(Object[] args)

   at proxy_2.EndLimitRecords(IAsyncResult )}

 

 

After some perseverance and research done by Marc, he figured out that the problem was due to the size of the data we were returning and the default RIA services settings... The problem was resolved by adding the following element to the config file:

 

<system.serviceModel>

    <client />

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"

      multipleSiteBindingsEnabled="true" />

    <services>

      <service name="UILoadTest.Web.TestService"

   behaviorConfiguration="RIASvcBehavior"> </service>

    </services>

    <behaviors>

      <serviceBehaviors>

        <behavior name="RIASvcBehavior">

          <serviceMetadata httpGetEnabled="true" />

          <serviceDebug includeExceptionDetailInFaults="True" />

          < dataContractSerializermaxItemsInObjectGraph = "655360"/>

        </behavior>

      </serviceBehaviors>

    </behaviors>

    <bindings>

      <customBinding>

        <binding name="BinaryHttpBinding">

          <binaryMessageEncoding>

            < readerQuotasmaxDepth = "32"maxStringContentLength="888192"maxArrayLength="2147483647"

maxBytesPerRead = "2147483647"maxNameTableCharCount="16384" />

          </ binaryMessageEncoding >

          < httpTransportmaxReceivedMessageSize = "2147483647" maxBufferSize = "2147483647" />

        </binding>

      </customBinding>

    </bindings>

  </system.serviceModel>

 

 

Hope this will save some troubleshooting time to some of you…

Comments

  • Anonymous
    October 12, 2010
    Thanks very much, it solved my major issue with WCF

  • Anonymous
    December 05, 2011
    Thanks, this solved my issue with passing a large binary parameter to my webservice.

  • Anonymous
    July 15, 2014
    Thanks for your help, I searched lot of article related to this error and finally I am able to resolved it through your code. Thanks a ton.