2

We store Entity Framework POCO objects in session and we have the ProxyCreationEnabled set to True.We have no problem serializing or deserializing the session except when the app pool restarts. It throws an error " Unable to load type System.Data.Entity.DynamicProxies.User_BEBEEB3C76C0999BF9A2B6F808EF066F350ADF3D85291467CF1F38C56777DA8A required for deserialization."

Any thoughts on why this is happening? Also, can we get away with having dynamic proxies in session if we are planning to load balance the code across more than one web server?

Thanks!

Neel
  • 192
  • 6
  • you probably need to disable proxies and deal with consequences. This might be helpful: http://stackoverflow.com/questions/7276507/serializable-classes-and-dynamic-proxies-in-ef-how – Pawel Jan 28 '15 at 00:10
  • We cannot disable the proxies as we would need to track the changes on the entity objects. – Neel Jan 30 '15 at 17:13
  • Maybe this is a duplicate? http://stackoverflow.com/questions/13077328/serialization-of-entity-framework-objects-with-one-to-many-relationship – Michi-2142 Jul 09 '15 at 09:08

1 Answers1

0

I have the same problem like you. The only reason I found, is that the lazy loading does not correctly load the properties anyway. Maybe a timing issue!?

For me there was only one solution until now:

Set the ProxyCreationEnabled = false;

Michi-2142
  • 1,170
  • 3
  • 18
  • 39