Silverlight Fetch works, but update fails

Silverlight Fetch works, but update fails

Old forum URL: forums.lhotka.net/forums/t/6952.aspx


esaulsberry posted on Friday, May 15, 2009

I'm having difficulty with a CSLA / Silverlight app. I'm using the Silverlight CSLA DataProvider control with business objects on the client and server. I've constructed a business object (editible root) with various properties, a child collection, with editble child objects. The business object is being fetched properly and is binding to the WPF controls in the Silverlight client. I can set breakpoints and watch the progression of the fetch:

In Csla.DataPortalClient.WcfProxy
public void BeginFetch(object criteria)
public void BeginFetch(object criteria, object userState)

In Clsa.WcfPortal.WcfPortalClient.WcfPortalClientChannel
public System.IAsyncResult BeginFetch(Csla.WcfPortal.CriteriaRequest request, System.AsyncCallback callback, object asyncState) {

In Csla.Server.Hosts.Silverlight.WcfPortal
public WcfResponse Fetch(CriteriaRequest request)

In Csla.Server.DataPortal
public DataPortalResult Fetch(Type objectType, object criteria, DataPortalContext context)

(the fetch in the business object happens)

In Csla.DataPortalClient.WcfProxy<T>
private void proxy_FetchCompleted(object sender, Csla.WcfPortal.FetchCompletedEventArgs e)

The data shows up bound to the form. Backslapping and beers all around.

The save button uses the attached InvokeMethod property

<Button Height="50" x:Name="BtnUserProfileSave" Width="96" Content="OK" csla:InvokeMethod.MethodName="Save" csla:InvokeMethod.Resource="{StaticResource MyData}" csla:InvokeMethod.TriggerEvent="Click" IsEnabled="{Binding Source={StaticResource MyData}, Path=CanSave, Mode=OneWay}"/>

Now, if I change some of the data on the form and click the save button and set breakpoints in the expected path, it starts hitting them like it did in the fetch....

Csla.DataPortalClient.WcfProxy
public void BeginUpdate(object obj, object userState)

In Clsa.WcfPortal.WcfPortalClient.WcfPortalClientChannel
public System.IAsyncResult BeginUpdate(Csla.WcfPortal.UpdateRequest request, System.AsyncCallback callback, object asyncState) {

Breaks in the update code path corresponding to the fetch code path aren't hit

In Csla.Server.Hosts.Silverlight.WcfPortal
public WcfResponse Update(UpdateRequest request) (not hit)

In Csla.Server.DataPortal
public DataPortalResult Update(object
obj, DataPortalContext context) (not hit)

The debugger then breaks on

public Csla.WcfPortal.WcfResponse EndUpdate(System.IAsyncResult result) {

with a "The remote server returned an error: NotFound" message.

It's as if the WCF channel on the server can't find the Update function in the Csla.Server.Hosts.Silverlight.WcfPortal part of the framework.  The WCF channels seem to be set up correctly though as the fetch is working fine.

I'm now a bit stimied. Can anyone suggest a course of action to resolve this? Thanks.

sergeyb replied on Friday, May 15, 2009

Do you have break on thrown exceptions turned on in Debug->Exceptions and have your solution setup so that you can debug client and server code simultaneously (WCF is hosted in the same web site as SL app)?  Those would be my first steps in figuring this out.  If you are sure that WCF is configured properly, then there is an exception thrown somewhere that is interpreted as 404 (which is really most exceptions in WCF/Silverlight combination), and you are just not seeing it.

 

Sergey Barskiy

Principal Consultant

office: 678.405.0687 | mobile: 404.388.1899

Magenic ®

Microsoft Worldwide Partner of the Year | Custom Development Solutions, Technical Innovation

 

From: esaulsberry [mailto:cslanet@lhotka.net]
Sent: Friday, May 15, 2009 10:24 AM
To: Sergey Barskiy
Subject: [CSLA .NET] Silverlight Fetch works, but update fails

 

I'm having difficulty with a CSLA / Silverlight app. I'm using the Silverlight CSLA DataProvider control with business objects on the client and server. I've constructed a business object (editible root) with various properties, a child collection, with editble child objects. The business object is being fetched properly and is binding to the WPF controls in the Silverlight client. I can set breakpoints and watch the progression of the fetch:

In Csla.DataPortalClient.WcfProxy
public void BeginFetch(object criteria)
public void BeginFetch(object criteria, object userState)

In Clsa.WcfPortal.WcfPortalClient.WcfPortalClientChannel
public System.IAsyncResult BeginFetch(Csla.WcfPortal.CriteriaRequest request, System.AsyncCallback callback, object asyncState) {

In Csla.Server.Hosts.Silverlight.WcfPortal
public WcfResponse Fetch(CriteriaRequest request)

In Csla.Server.DataPortal
public DataPortalResult Fetch(Type objectType, object criteria, DataPortalContext context)

(the fetch in the business object happens)

In Csla.DataPortalClient.WcfProxy<T>
private void proxy_FetchCompleted(object sender, Csla.WcfPortal.FetchCompletedEventArgs e)

The data shows up bound to the form. Backslapping and beers all around.

The save button uses the attached InvokeMethod property

<Button Height="50" x:Name="BtnUserProfileSave" Width="96" Content="OK" csla:InvokeMethod.MethodName="Save" csla:InvokeMethod.Resource="{StaticResource MyData}" csla:InvokeMethod.TriggerEvent="Click" IsEnabled="{Binding Source={StaticResource MyData}, Path=CanSave, Mode=OneWay}"/>

Now, if I change some of the data on the form and click the save button and set breakpoints in the expected path, it starts hitting them like it did in the fetch....

Csla.DataPortalClient.WcfProxy
public void BeginUpdate(object obj, object userState)

In Clsa.WcfPortal.WcfPortalClient.WcfPortalClientChannel
public System.IAsyncResult BeginUpdate(Csla.WcfPortal.UpdateRequest request, System.AsyncCallback callback, object asyncState) {

Breaks in the update code path corresponding to the fetch code path aren't hit

In Csla.Server.Hosts.Silverlight.WcfPortal
public WcfResponse Update(UpdateRequest request) (not hit)

In Csla.Server.DataPortal
public DataPortalResult Update(object obj, DataPortalContext context) (not hit)

The debugger then breaks on

public Csla.WcfPortal.WcfResponse EndUpdate(System.IAsyncResult result) {

with a "The remote server returned an error: NotFound" message.

It's as if the WCF channel on the server can't find the Update function in the Csla.Server.Hosts.Silverlight.WcfPortal part of the framework.  The WCF channels seem to be set up correctly though as the fetch is working fine.

I'm now a bit stimied. Can anyone suggest a course of action to resolve this? Thanks.



esaulsberry replied on Friday, May 15, 2009

Hi Sergey, thanks for responding.

I do have the WCF service in the same web site as the silverlight app is hosted from.  I can set break points all along the process and hit them on both the server and client side for the fetch.  On the update call it doesn't hit any of the break points on the server.

I've turned on thrown exceptions for everything in the debugger but the behavior is the same.

The only WCF function in play here is they CSLA WCF Portal.   I'm puzzeled by it being able to call through this to do the fetch but not the update. Here's the configuration:

Client

<endpoint address="http://esaulsberry.horizon-boss.com/OSMobileStock/AgService/WcfPortal.svc"

binding="basicHttpBinding" bindingConfiguration="basicBindingConfig"

contract="Csla.WcfPortal.IWcfPortal" name="CslaWcfPortal" />

<binding name="basicBindingConfig" maxBufferSize="2147483647"

maxReceivedMessageSize="2147483647">

<security mode="None" />

</binding>

Server

<service behaviorConfiguration="OSMUnSecure" name="Csla.Server.Hosts.Silverlight.WcfPortal">

<endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicBinding" contract="Csla.Server.Hosts.Silverlight.IWcfPortal">

<identity>

<dns value="localhost" />

</identity>

</endpoint>

<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />

</service>

<binding name="BasicBinding">

<security mode="None">

<message clientCredentialType="UserName"/>

</security>

</binding>

<behavior name="OSMUnSecure">

<serviceMetadata httpGetEnabled="true"/>

<serviceDebug includeExceptionDetailInFaults="true"/>

</behavior>

sergeyb replied on Friday, May 15, 2009

I think I know what the problem is.  I think you are dealing with reader quotas issue.  If you are sending more than default (which is 64K I think), you will get that error.  That is why fetch is working.

 

Server:

<basicHttpBinding>

                <binding name="basicHttpBinding_IWcfPortal"

                                                                        maxReceivedMessageSize="2147483647"

                    <readerQuotas

                                                                        maxBytesPerRead="2147483647"

                                                                        maxArrayLength="2147483647"

                                                                        maxStringContentLength="2147483647"

                                                                                    maxDepth="1024"/>

                </binding>

            </basicHttpBinding>

 

Client:

<basicHttpBinding>

                <binding      name="basicHttpBinding_IWcfPortal"

                                                                                    maxBufferSize="2147483647"

                                                                                    maxReceivedMessageSize="2147483647”>

                </binding>

 

Sergey Barskiy

Principal Consultant

office: 678.405.0687 | mobile: 404.388.1899

Magenic ®

Microsoft Worldwide Partner of the Year | Custom Development Solutions, Technical Innovation

 

From: esaulsberry [mailto:cslanet@lhotka.net]
Sent: Friday, May 15, 2009 2:39 PM
To: Sergey Barskiy
Subject: Re: [CSLA .NET] RE: Silverlight Fetch works, but update fails

 

Hi Sergey, thanks for responding.

I do have the WCF service in the same web site as the silverlight app is hosted from.  I can set break points all along the process and hit them on both the server and client side for the fetch.  On the update call it doesn't hit any of the break points on the server.

I've turned on thrown exceptions for everything in the debugger but the behavior is the same.

The only WCF function in play here is they CSLA WCF Portal.   I'm puzzeled by it being able to call through this to do the fetch but not the update. Here's the configuration:

Client

<endpoint address="http://esaulsberry.horizon-boss.com/OSMobileStock/AgService/WcfPortal.svc"

binding="basicHttpBinding" bindingConfiguration="basicBindingConfig"

contract="Csla.WcfPortal.IWcfPortal" name="CslaWcfPortal" />

<binding name="basicBindingConfig" maxBufferSize="2147483647"

maxReceivedMessageSize="2147483647">

<security mode="None" />

</binding>

Server

<service behaviorConfiguration="OSMUnSecure" name="Csla.Server.Hosts.Silverlight.WcfPortal">

<endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicBinding" contract="Csla.Server.Hosts.Silverlight.IWcfPortal">

<identity>

<dns value="localhost" />

</identity>

</endpoint>

<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />

</service>

<binding name="BasicBinding">

<security mode="None">

<message clientCredentialType="UserName"/>

</security>

</binding>

<behavior name="OSMUnSecure">

<serviceMetadata httpGetEnabled="true"/>

<serviceDebug includeExceptionDetailInFaults="true"/>

</behavior>



esaulsberry replied on Friday, May 15, 2009

Wow.  That gets me a lot further.  It looks like I've got a garden variety bug in the child update but that should be easy to fix.  It hits the breaks on the server side now.  Thanks for the help.  I wouldn't have thought of that. 

sergeyb replied on Friday, May 15, 2009

Sure

 

Sergey Barskiy

Principal Consultant

office: 678.405.0687 | mobile: 404.388.1899

cid:_2_0648EA840648E85C001BBCB886257279
Microsoft Worldwide Partner of the Year | Custom Development Solutions, Technical Innovation

 

From: esaulsberry [mailto:cslanet@lhotka.net]
Sent: Friday, May 15, 2009 3:08 PM
To: Sergey Barskiy
Subject: Re: [CSLA .NET] RE: RE: Silverlight Fetch works, but update fails

 

Wow.  That gets me a lot further.  It looks like I've got a garden variety bug in the child update but that should be easy to fix.  It hits the breaks on the server side now.  Thanks for the help.  I wouldn't have thought of that. 

jfreeman replied on Monday, November 09, 2009

Sergey,

I'm having the same issue using a WinForm app with WCF. I just recently upgraded from CSLA 3.5 to 3.7.1. Any ideas?

Thanks,
Jonathan

Copyright (c) Marimer LLC