title: MVC Session Serialization Error.Unable to find assembly 'EntityFrameworkDynamicProxies
body: <p>I have a mvc commerce project. I use sessions for user login. For example I use membership information in session like this.Ofc Session is not null.</p>
  
  <pre><code>Member member=Session["MemberSuccess"] as Member
  </code></pre>
  
  <p>Also because of the pool time of shared hostings I use sql state session.It works fine at localhost. But when i upload it to the server it gives me an error like this;</p>
  
  <pre><code>Unable to find assembly 'EntityFrameworkDynamicProxies-DataLayer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
  </code></pre>
  
  <p>I don't know is there any relevance but my servers trust level is full. I use entity framework. And I keep edmx file in a seperate class library. Also I tried 
  adding [Serializable] attiributes at classes under .tt file. </p>
  
  <p>And here is the stack trace</p>
  
  <pre><code>[SerializationException: Unable to find assembly 'EntityFrameworkDynamicProxies-DataLayer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.]
     System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly() +3124514
     System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAssemblyInfo assemblyInfo, String name) +10830282
     System.Runtime.Serialization.Formatters.Binary.ObjectMap..ctor(String objectName, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[] typeInformationA, Int32[] memberAssemIds, ObjectReader objectReader, Int32 objectId, BinaryAssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable) +120
     System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped record) +286
     System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryHeaderEnum binaryHeaderEnum) +57
     System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run() +581
     System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage) +120
     System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage) +186
     System.Web.Util.AltSerialization.ReadValueFromStream(BinaryReader reader) +937
     System.Web.SessionState.SessionStateItemCollection.ReadValueFromStreamWithAssert() +55
     System.Web.SessionState.SessionStateItemCollection.DeserializeItem(String name, Boolean check) +289
     System.Web.SessionState.SessionStateItemCollection.get_Item(String name) +19
     System.Web.SessionState.HttpSessionStateContainer.get_Item(String name) +11
     System.Web.HttpSessionStateWrapper.get_Item(String name) +14
     ASP._Page_Views_Shared__Layout_cshtml.Execute() +186
     System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +198
     System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +104
     System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +90
     System.Web.WebPages.&lt;&gt;c__DisplayClass7.&lt;RenderPageCore&gt;b__6(TextWriter writer) +230
     System.Web.WebPages.HelperResult.WriteTo(TextWriter writer) +10
     System.Web.WebPages.WebPageBase.Write(HelperResult result) +80
     System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action`1 body) +64
     System.Web.WebPages.WebPageBase.PopContext() +262
     System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +98
     System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +255
     System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +107
     System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +291
     System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13
     System.Web.Mvc.&lt;&gt;c__DisplayClass1a.&lt;InvokeActionResultWithFilters&gt;b__17() +23
     System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +245
     System.Web.Mvc.&lt;&gt;c__DisplayClass1c.&lt;InvokeActionResultWithFilters&gt;b__19() +22
     System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +176
     System.Web.Mvc.Async.&lt;&gt;c__DisplayClass2a.&lt;BeginInvokeAction&gt;b__20() +75
     System.Web.Mvc.Async.&lt;&gt;c__DisplayClass25.&lt;BeginInvokeAction&gt;b__22(IAsyncResult asyncResult) +99
     System.Web.Mvc.Async.WrappedAsyncResult`1.End() +50
     System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +44
     System.Web.Mvc.&lt;&gt;c__DisplayClass1d.&lt;BeginExecuteCore&gt;b__18(IAsyncResult asyncResult) +14
     System.Web.Mvc.Async.&lt;&gt;c__DisplayClass4.&lt;MakeVoidDelegate&gt;b__3(IAsyncResult ar) +23
     System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
     System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +58
     System.Web.Mvc.Async.&lt;&gt;c__DisplayClass4.&lt;MakeVoidDelegate&gt;b__3(IAsyncResult ar) +23
     System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
     System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +48
     System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
     System.Web.Mvc.&lt;&gt;c__DisplayClass8.&lt;BeginProcessRequest&gt;b__3(IAsyncResult asyncResult) +25
     System.Web.Mvc.Async.&lt;&gt;c__DisplayClass4.&lt;MakeVoidDelegate&gt;b__3(IAsyncResult ar) +23
     System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
     System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +31
     System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
     System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9651688
     System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +155
  </code></pre>