Welcome! Log In Create A New Profile

Advanced

Deserialization issue when cache object from WCF Service

Posted by Adeel Nasim 
Hi,
We are using MemCache for caching in our ASP.NET Website for performance
improvements.



We use WCF Service at backend and our website and other Silverlight
applications call these WCF services.



Now, whenever a service call is made, service retrieves data from the
database and sets it in the MemCache server.



At client (application) end, before making service call, we first want to
check the memCache server, if it already has that particular object, but
unfortunately, this is not happening, we always get NULL if we want to check
data from the cache server.


On further digging it down, we came to know that when MemCache de-serialize
our object at client end (website), it doesn’t find the DLL of the service
and throws the exception at de-serialization and returns NULL object.

When i put the WCF service DLL in Bin folder of my website (that i don't
want to do) than the de-serialzation working fine but i stuck into another
problem when i tried cast the object into WCF service reference object, it
gives error of invalide cast because the deserialized object (deserialize by
service DLL) cannot converted into service reference object due to different
namespace.

My question is, does .NET framework has any support or workaround by which
we can de-serialize byte array into real objects without having the DLL and
using only the service references.

Thanks
Adeel
you. cannot deserialize real clr objects without having their code around. (when using the default .net serializer)

what you can do in this instance is to use an intermediary format, for example serialize all the objects into a json string and store this string in the cache. the other end can deserialize that string indo a dictionay or another object which looks the sqme as the source.

On Jul 22, 2010, at 4:58 PM, Adeel Nasim <[email protected]> wrote:

> Hi,
> We are using MemCache for caching in our ASP.NET Website for performance improvements.
>
> We use WCF Service at backend and our website and other Silverlight applications call these WCF services.
>
> Now, whenever a service call is made, service retrieves data from the database and sets it in the MemCache server.
>
> At client (application) end, before making service call, we first want to check the memCache server, if it already has that particular object, but unfortunately, this is not happening, we always get NULL if we want to check data from the cache server.
>
> On further digging it down, we came to know that when MemCache de-serialize our object at client end (website), it doesn’t find the DLL of the service and throws the exception at de-serialization and returns NULL object.
>
> When i put the WCF service DLL in Bin folder of my website (that i don't want to do) than the de-serialzation working fine but i stuck into another problem when i tried cast the object into WCF service reference object, it gives error of invalide cast because the deserialized object (deserialize by service DLL) cannot converted into service reference object due to different namespace.
>
> My question is, does .NET framework has any support or workaround by which we can de-serialize byte array into real objects without having the DLL and using only the service references.
>
> Thanks
> Adeel
or maybe you could the datacontractserializer could help... it depends on
the client you're using

if you're using the "Enyim" client, please send me an email (let's take this
off the list) and i'll try to help


a.


2010/7/22 a. <[email protected]>

> you. cannot deserialize real clr objects without having their code around..
> (when using the default .net serializer)
>
> what you can do in this instance is to use an intermediary format, for
> example serialize all the objects into a json string and store this string
> in the cache. the other end can deserialize that string indo a dictionay or
> another object which looks the sqme as the source.
>
>
> On Jul 22, 2010, at 4:58 PM, Adeel Nasim <[email protected]> wrote:
>
> Hi,
> We are using MemCache for caching in our http://ASP.NETASP.NET Website
> for performance improvements.
>
>
>
> We use WCF Service at backend and our website and other Silverlight
> applications call these WCF services.
>
>
>
> Now, whenever a service call is made, service retrieves data from the
> database and sets it in the MemCache server.
>
>
>
> At client (application) end, before making service call, we first want to
> check the memCache server, if it already has that particular object, but
> unfortunately, this is not happening, we always get NULL if we want to check
> data from the cache server.
>
>
> On further digging it down, we came to know that when MemCache de-serialize
> our object at client end (website), it doesn’t find the DLL of the service
> and throws the exception at de-serialization and returns NULL object.
>
> When i put the WCF service DLL in Bin folder of my website (that i don't
> want to do) than the de-serialzation working fine but i stuck into another
> problem when i tried cast the object into WCF service reference object, it
> gives error of invalide cast because the deserialized object (deserialize by
> service DLL) cannot converted into service reference object due to different
> namespace.
>
> My question is, does .NET framework has any support or workaround by
> which we can de-serialize byte array into real objects without having the
> DLL and using only the service references.
>
> Thanks
> Adeel
>
>
Sorry, only registered users may post in this forum.

Click here to login