WCF Compression

WCF Compression

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


danielw posted on Thursday, March 19, 2009

I have plugged in compression as per the example remoteportal with compressed proxy. and the compression is brilliant. However when doing dataportal creates we are getting a header checksum illigal error. I have tested the remoteportalwithcompressedproxy example and it also gives this error.

Does anybody have any idea why this might be happening

Cheers

Daniel

RockfordLhotka replied on Thursday, March 19, 2009

What is throwing the exception? WCF, the compression library, or some other code?

I'm using the same technique in the InventoryDemo sample, and I know a few people are using it for actual app development (not samples), so I don't believe this is a general issue.

danielw replied on Thursday, March 19, 2009

We have a form with several objects on it. The first objects only get data via the dataportal, the last object (the one that's throwing the error) issues a dataportal create. I've debugged the code and it seems that the create command doesn't go through the ConvertRequest method on the client in CompressedProxy.cs but at the server end in CompressedHost.cs the request is then caught in ConvertRequest which tries to decompress the data (which hasn't been compressed)

The response method then throws the exception

Have you got a copy of the InventoryDemo sample so we can compare?

sergeyb replied on Thursday, March 19, 2009

I vaguely remember fixing something like this a while ago.   Are you running the latest code?  If not, could you try to download the latest from SVN and give that a try?

 

Thanks.

 

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: danielw [mailto:cslanet@lhotka.net]
Sent: Thursday, March 19, 2009 8:49 AM
To: Sergey Barskiy
Subject: Re: [CSLA .NET] WCF Compression

 

We have a form with several objects on it. The first objects only get data via the dataportal, the last object (the one that's throwing the error) issues a dataportal create. I've debugged the code and it seems that the create command doesn't go through the ConvertRequest method on the client in CompressedProxy.cs but at the server end in CompressedHost.cs the request is then caught in ConvertRequest which tries to decompress the data (which hasn't been compressed)

The response method then throws the exception

Have you got a copy of the InventoryDemo sample so we can compare?



danielw replied on Thursday, March 19, 2009

Thanks to you both.

Download 6.5.1 and it works fine that will teach me for getting behind with my versions bring on v6.5.2

Cheers

Daniel

 

 
Daniel Wood | Developer | JMC IT, Riverside, Agecroft Road, Manchester, M27 8SJ | Tel: 0161 925 7777 | Fax: 0161 925 7700 | Email: Daniel.Wood@jmc.it | Web: www.jmc.it
 
This e-mail and any files transmitted with it are confidential and are intended solely for the use of the intended recipient(s). If you are not the intended recipient, you must not copy, distribute or take any action based on this communication. If you have received this communication in error please contact  Daniel.Wood@jmc.it  and delete this communication and any copies of it. Any views or opinions presented are solely those of the author and do not necessarily represent those of JMC IT. JMC IT monitors e-mails to ensure its systems operate effectively and to minimise the risk of viruses.
 
JM Computing Limited | Registered in Cardiff No. 1131358 | Registered office as above

From: Sergey Barskiy [mailto:cslanet@lhotka.net]
Sent: 19 March 2009 12:51
To: Daniel Wood
Subject: RE: [CSLA .NET] WCF Compression

 

I vaguely remember fixing something like this a while ago.   Are you running the latest code?  If not, could you try to download the latest from SVN and give that a try?

 

Thanks.

 

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: danielw [mailto:cslanet@lhotka.net]
Sent: Thursday, March 19, 2009 8:49 AM
To: Sergey Barskiy
Subject: Re: [CSLA .NET] WCF Compression

 

We have a form with several objects on it. The first objects only get data via the dataportal, the last object (the one that's throwing the error) issues a dataportal create. I've debugged the code and it seems that the create command doesn't go through the ConvertRequest method on the client in CompressedProxy.cs but at the server end in CompressedHost.cs the request is then caught in ConvertRequest which tries to decompress the data (which hasn't been compressed)

The response method then throws the exception

Have you got a copy of the InventoryDemo sample so we can compare?

 



 

Charleh replied on Thursday, March 19, 2009

I think Dan means 3.6.1 unless he's found Rocky's secret code repository!

He's had a difficult few days, I think the stress levels are very high ;)

mamboer replied on Friday, March 20, 2009

I folowed the lastest InventoryDemo,but always failed with that exception:

Header checksum illegal

in the line "int read = stream.Read(buffer, 0, buffer.Length);"

Can you explain how to fix that more clearly?




danielw replied on Friday, March 20, 2009

The problem we had was that the Dataportal_Create was not calling the compress call from Silverlight. But the server side was trying to decompress it and as it was not compressed it was giving an error.

This bug was fixed in v 3.5.1 so downloading and using this one fixed the issue.

 

Cheers

Daniel

 

 
Daniel Wood | Developer | JMC IT, Riverside, Agecroft Road, Manchester, M27 8SJ | Tel: 0161 925 7777 | Fax: 0161 925 7700 | Email: Daniel.Wood@jmc.it | Web: www.jmc.it
 
This e-mail and any files transmitted with it are confidential and are intended solely for the use of the intended recipient(s). If you are not the intended recipient, you must not copy, distribute or take any action based on this communication. If you have received this communication in error please contact  Daniel.Wood@jmc.it  and delete this communication and any copies of it. Any views or opinions presented are solely those of the author and do not necessarily represent those of JMC IT. JMC IT monitors e-mails to ensure its systems operate effectively and to minimise the risk of viruses.
 
JM Computing Limited | Registered in Cardiff No. 1131358 | Registered office as above

From: mamboer [mailto:cslanet@lhotka.net]
Sent: 20 March 2009 05:06
To: Daniel Wood
Subject: Re: [CSLA .NET] RE: WCF Compression

 

I folowed the lastest InventoryDemo,but always failed with that exception:

Header checksum illegal

in the line "int read = stream.Read(buffer, 0, buffer.Length);"

Can you explain how to fix that more clearly?






 

mamboer replied on Friday, March 20, 2009

Hi,
I'm using the latest Csla.net 3.6.2~
Since this issue had been fixed in 3.5.1,why still accurs in 3.6.x?

danielw replied on Friday, March 20, 2009

No idea ,

It must be for a different reason

Sorry mate

 

 
Daniel Wood | Developer | JMC IT, Riverside, Agecroft Road, Manchester, M27 8SJ | Tel: 0161 925 7777 | Fax: 0161 925 7700 | Email: Daniel.Wood@jmc.it | Web: www.jmc.it
 
This e-mail and any files transmitted with it are confidential and are intended solely for the use of the intended recipient(s). If you are not the intended recipient, you must not copy, distribute or take any action based on this communication. If you have received this communication in error please contact  Daniel.Wood@jmc.it  and delete this communication and any copies of it. Any views or opinions presented are solely those of the author and do not necessarily represent those of JMC IT. JMC IT monitors e-mails to ensure its systems operate effectively and to minimise the risk of viruses.
 
JM Computing Limited | Registered in Cardiff No. 1131358 | Registered office as above

From: mamboer [mailto:cslanet@lhotka.net]
Sent: 20 March 2009 12:37
To: Daniel Wood
Subject: Re: [CSLA .NET] RE: RE: WCF Compression

 

Hi,
I'm using the latest Csla.net 3.6.2~
Since this issue had been fixed in 3.5.1,why still accurs in 3.6.x?



 

mamboer replied on Friday, March 20, 2009

Ease,mate:)
Hope that some can give me some ideas on this problem...

RockfordLhotka replied on Friday, March 20, 2009

I don't have a suggestion at this point.

The InventoryDemo project is built against 3.6.2, and if you change the NewProductEdit() factory method so it creates the object on the server (thus going through the data portal, which is using compression) it works fine:

    public static void NewProductEdit(EventHandler<DataPortalResult<ProductEdit>> callback)
    {
      var dp = new DataPortal<ProductEdit>(); // (DataPortal.ProxyModes.LocalOnly);
      dp.CreateCompleted += callback;
      dp.BeginCreate();
    }

Does InventoryDemo fail on your machine?

mamboer replied on Friday, March 20, 2009

@Rocky,
  The InventoryDemo runs well on my pc.
 
  I found the reason for my demo,but the case still seems somewhat strange.

  In the App.xaml.cs,if i put the "Csla.DataPortal.ProxyTypeName=XXX;" after the line "this.RootVisual = new Page();",those client requests will bypass the custom compressed wcf proxy,which causes the "Header checksum illegal" exception in the server side.Because uncompressed data can't be decompressed!
  While i set the Csla.DataPortal.ProxyTypeName before "this.RootVisual = new Page();"(like InventoryDemo do),things go well.

  What's strange is that the fact above is not true to the InventoryDemo.

  My demo uses a CslaDataProvider with "IsInitialLoadEnabled=true" to load a list of bo while InventoryDemo uses a button to trigger the data loading.

    

RockfordLhotka replied on Saturday, March 21, 2009

The InventoryDemo app sets the ProxyTypeName before loading the first page. That is required, because when the 'new Page()' code runs it triggers creation of any data provider controls, which will invoke the data portal, which would use the default data portal proxy, not the one you actually want it to use.

So it is absolutely true that ProxyTypeName must be set before any data portal calls occur - which usually means in App.xaml.cs before  the RootVisual is set.

mamboer replied on Saturday, March 21, 2009

Thank you for revealing the fact behind the scenes .

decius replied on Monday, July 06, 2009

I also am getting the header checksum illegal error from the ICSharp libraries when attempting to decompress and read the stream and I am using Csla 3.6.2.

I used the same code in another project and it worked fine.  I've read everything above and am still stuck pretty hard here.  I've been trying to avoid debugging the source code of these ICSharp libraries, but that very well might be my next stop.

 

RockfordLhotka replied on Monday, July 06, 2009

Make sure both the client and server are using your compression. The most common cause for this particular problem is that either the client or the server aren’t configured to use your new proxy/host classes, so one end or the other isn’t actually using compression.

 

Rocky

decius replied on Monday, July 06, 2009

Thnx Rocky.  Yep, my problem was simple.

As stated above, in the App.xaml.cs ApplicationStatup you have to set the ProxyTypeName before RootVisual is assigned.  I had set it, but I was setting it to the usual

Csla.DataPortal.ProxyTypeName = "Csla.DataPortalClient.WcfProxy, Csla";

instead of my compressed proxy typename

Csla.DataPortal.ProxyTypeName = typeof(Library.Compression.CompressedProxy<>).AssemblyQualifiedName;

 

decius replied on Monday, July 06, 2009

*duped post, sry*

Copyright (c) Marimer LLC