473,385 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Deserialize (maybe with a HeaderHandler?)

Hi

I have been using a webservice to return a dataset to a WinForms application
and it has been working 100%. Recently data have increased and I have
started looking for a way to compress the dataset. I found a number of
articles the one I started using was:
http://www.codeproject.com/csharp/cs...select=1195709

When I do it in a little demo app it works 100%, but as soon as I try and
deserialize the byte array I get from my webservice I get a "Unable to find
assembly 'App_Code.yr6fuy8w, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null'." error. Where 'App_Code.yr6fuy8w' seems to refer to
the webservice. (SEE ATTACHMENT)

I am not an expert when it comes to web service's, and definately not when
it comes to SOAP and Remoting. Can anyone help me in the right direction
please. I see Deserialize has a second overload with a
Messaging.HeaderHandler - maybe this is the option but where do I get the
HeaderHandler to pass?

Help will be greatly appreciated - I am starting to pull the hair out my
head :)

Francois

Jul 25 '06 #1
3 4138
Hello Francois,

Welcome to the MSDN newsgroup.

From your description, I understand you're developing an ASP.NET webservice
which return some large dataset (typed?) to the client .net application.
Currently you've used a component library (from the following codeproject
space) to perform some DataSet compression task,

http://www.codeproject.com/csharp/cs...rumid=164592&e
xp=0&select=1195709

however, it will report "asembly 'App_code.....' ...." not found error at
runtime, correct?

As for this issue, it is likely an assembly binding/search issue caused by
..net binary serialization, I've downloaded the code package of that
codeproject article, the "CompressionHelper" class contains many
compressxxx methods and are you using the "CompressDataSet" method to
compress your DataSet, and then convert the compressed byte[] into string
and return to client?

Based on my review on the code, the "CompressDataSet" method is using
"BinaryFormatter" to binary serialize the DataSet into byte stream (as
below);

=============================
public static byte[] CompressDataSet(
DataSet input )
{
BinaryFormatter bf = new BinaryFormatter();

using ( MemoryStream ms = new MemoryStream() )
{
bf.Serialize( ms, input );
return CompressBytes( ms.GetBuffer() );
}
}
==============================

And binaryformatter serializer will identify the exact class name and
assembly(when serializing and deserializing), that's why you get the
assembly not found at client-side when deserializing the byte[] into
dataset(it is looking for the DataSet's assembly on server-side).

Therefore, for your scenario, you can consider the following means to
resolve the problem:

1. Still use the original "CompressDataSet" implementation, however, we
need to make sure our DataSet class's assemby is deployed in both server
webservice and client application projects. Since ASP.NET 2.0 will compile
DataSet (in App_code ) into a dynamic random assembly, I suggest you
separate the DataSet or other similar classes into a external class library
project. Thus, you can reference this class library assembly and classes in
both client and server project.

2. You can customize the CompressDataSet method and not use Binaryformatter
serialize. Instead, you can use DataSet.GetXml method to export the dataset
into XML string and use the compress component's CompressString method to
compress the DataSet's string format value. After that tranfer the
compressed string value to client.

Please let me know if you have anything unclear or if there is anything
else I missed.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to

http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial

response from the community or a Microsoft Support Engineer within 1
business day is

acceptable. Please note that each follow up response may take approximately
2 business days

as the support professional working with you may need further investigation
to reach the

most efficient resolution. The offering is not appropriate for situations
that require

urgent, real-time or phone-based interactions or complex project analysis
and dump analysis

issues. Issues of this nature are best handled working with a dedicated
Microsoft Support

Engineer by contacting Microsoft Customer Support Services (CSS) at

http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Jul 26 '06 #2
Hi Steven

It worked great, thanks. I couldn't use a pre-compiled assembly for the
dataset due to the nature of the application but sending it as a XML string
worked 100%.

I thought all deserialisations will need "the same assembly". Good thing it
doesn't and I can use a string!

Thanks

Francois
Jul 26 '06 #3
Thanks for your prompt response Francois,

Glad that it works for you.

Have a good day!

Cheers,

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.
Jul 26 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Ian Tompsett | last post by:
H I was wondering if it possible for an object to serialize/deserialize itself from XML. I'd be guessing that it would need to use the XmlSerializer class, but that seems to want to create a...
1
by: Kristian Kjems | last post by:
Look at the Code Snippet below: It is not possible to Deserialize the Animal in animalStr directly because the type of the animal is not known. Deserializing into the abstract type will not work...
5
by: Geoff | last post by:
Is it possible to pull a single node (element) out of a complex XML file, using SelectSingleNode(), and then deserialize that node to an object? Could someone please post, or point me to, a...
0
by: Fruber Malcome | last post by:
I'm getting a very weird exception and hoping someone may be able to help. I have an Office Add-In that lives in a .dll (for email reference ai.dll) ai.dll makes calls into the core part of the...
19
by: Sharon | last post by:
Hi, When I'm doing BinaryFormatter.Deserialize() over a TCP socket. When I'm closing the TcpListener by invoking the TcpListener.Stop(); I get: System.IO.IOException with message "Unable to...
1
by: Sriranjan | last post by:
Hi, How do I deserialize an object based on a random XML file? I have tried using the XMLSerializer.Deserialize method but it does not set the values for the members. I need tto do this...
1
by: Yewen Tang | last post by:
I have a schema file datamodel.xsd, element "properties" is declared as a type of "baseProperty". The schema file also defines "derivedProperty" is a derived type of "baseProperty". <?xml...
2
by: Lambuz | last post by:
Hi all, I'm triying to create a prototype of a smart client that using .NET Remoting. I've got an assembly loaded into an HTML page by a tag object <OBJECT id="myID" height="150" width="300"...
0
by: connectpalm03-forum | last post by:
I have a class named (MyClassA) in ControlClasses.dll and was able to serialize it to database. Like below SaveTo(MemoryStream stream) { IFormatter formatter = new BinaryFormatter(); ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.