The remote server returned an error: NotFound

The remote server returned an error: NotFound

Old forum URL:

lds posted on Tuesday, May 03, 2011

Hi Rocky,

I have been reading your great ebooks. Using them as a guide I have been
working on a Silverlight App that follows the setup of "AzureHost" solution
in the "04-DataPortal-110426" sample folder.

I have an Editable Root abject that all works normal as long as its size
does not get too big, when the size increases and I try to save the
object I receive the Message "The remote server returned an error: NotFound.".

Next In order to eliminate all that I could be doing wrong in my solution
I took the "AzureHost" solution and made the following 3 changes to
reproduce the error;

// 1st Change
// Add a String Property.
public static readonly PropertyInfo<string> BigStringProperty = RegisterProperty<string>(c => c.BigString);
public string BigString
  get { return GetProperty(BigStringProperty); }
  set { SetProperty(BigStringProperty, value); }

public override void DataPortal_Create(Csla.DataPortalClient.LocalProxy<PersonEdit>.CompletedHandler handler)
  using (BypassPropertyChecks)
    Id = -1;

    // 2nd Change
    // This will push the size to where there will be an error when the object is saved.
    BigString = new string('x', 13000);

private void Application_Startup(object sender, StartupEventArgs e)
  // 3rd Change
  // Extend the limits.
  var binding = new BasicHttpBinding();
  binding.MaxBufferSize = int.MaxValue;
  binding.MaxReceivedMessageSize = int.MaxValue;
  binding.ReceiveTimeout = TimeSpan.FromMinutes(10);
  binding.SendTimeout = TimeSpan.FromMinutes(10);
  binding.OpenTimeout = TimeSpan.FromMinutes(10);
  Csla.DataPortalClient.WcfProxy.DefaultBinding = binding;
  Csla.DataPortalClient.WcfProxy.DefaultUrl = "";

  this.RootVisual = new MainPage();

With these changes made when the Save Button is pressed the followin error is
returned in OnError(Exception error) of OnPersonViewModel.cs

error {: The remote server returned an error: NotFound.
   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 Csla.WcfPortal.WcfPortalClient.WcfPortalClientChannel.EndUpdate(IAsyncResult result)
   at Csla.WcfPortal.WcfPortalClient.Csla.WcfPortal.IWcfPortal.EndUpdate(IAsyncResult result)
   at Csla.WcfPortal.WcfPortalClient.OnEndUpdate(IAsyncResult result)
   at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)
: The remote server returned an error: NotFound.
   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

: 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__DisplayClass4.<BeginOnUI>b__1(Object sendState)
} System.Exception {Csla.DataPortalException}

// I also added the following to Web.Config.
   <source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true">
       <add name="traceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="c:\temp\AzureHostTraces.log"  />
 <trace autoflush="true" />

And In the Log file there is a exception with the following Message:
The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter The InnerException message was 'There was an error deserializing the object of type

Csla.Server.Hosts.Silverlight.UpdateRequest. The maximum array length quota (16384) has been exceeded while reading XML data. This quota

may be increased by changing the MaxArrayLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line

1, position 24487.'.  Please see InnerException for more details.

Any Idea as to what it could be wrong?


RockfordLhotka replied on Tuesday, May 03, 2011

I think the endpoint element in the web.config of the web role is incorrect. It is missing the bindingConfiguration property:

<endpoint binding="basicHttpBinding" bindingConfiguration="basicHttpBinding_IWcfPortal"

 Let me know if that helps.

RockfordLhotka replied on Tuesday, May 03, 2011

You shouldn't have to extend the limits on the client btw, the default binding created by the data portal has the values maxed out.

I added the missing bindingConfiguration property to the web.config and that appears to solve the issue.

Thank you for helping to find this - I'll fix it in the ebook and sample code.

lds replied on Tuesday, May 03, 2011

Hi Rocky,

Thank you for taking a look at this, I removed the changes from App.xaml.cs and here is the updated Web.Config section.

    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
      <service name="Csla.Server.Hosts.WcfPortal" behaviorConfiguration="returnFaults">
        <endpoint binding="wsHttpBinding" contract="Csla.Server.Hosts.IWcfPortal" bindingConfiguration="wsHttpBinding_IWcfPortal"/>
      <service name="basicHttpBinding_IWcfPortal"  behaviorConfiguration="returnFaults" >
        <endpoint binding="basicHttpBinding"
        <binding name="basicHttpBinding_IWcfPortal" maxReceivedMessageSize="2147483647">
          <readerQuotas maxBytesPerRead="2147483647"
        <binding name="wsHttpBinding_IWcfPortal" maxReceivedMessageSize="2147483647">
          <readerQuotas maxBytesPerRead="2147483647"
        <behavior name="returnFaults">
          <serviceDebug includeExceptionDetailInFaults="true" />

I'm still getting the same error.


RockfordLhotka replied on Tuesday, May 03, 2011

Interesting. I agree that it fails. So does the IISHost project, so it isn't an Azure issue.

There must be some other configuration limit that was added to WCF in .NET 4 that's causing this issue...

RockfordLhotka replied on Tuesday, May 03, 2011

Ahh, we're missing this:


So the web.config should contain:

        <binding name="basicHttpBinding_IWcfPortal"
          <readerQuotas maxBytesPerRead="2147483647"


RockfordLhotka replied on Tuesday, May 03, 2011

Hmm, that doesn't seem to help either.

I'm open to suggestions at this point - clearly we're missing some config value...

RockfordLhotka replied on Tuesday, May 03, 2011

OK, now I feel really dumb...

The problem is a copy-paste issue or something. The service name is wrong, so the entire config section we're altering is being ignored...

The service name must match the name of the service in the svc file:

      <service name="Csla.Server.Hosts.Silverlight.WcfPortal"


lds replied on Tuesday, May 03, 2011

All works as it should now...

Thank You Rocky... I'm looking forward to read the rest of the ebooks!!!


Copyright (c) Marimer LLC