The serialized data is invalid
I am facing some problems when i deploy my site in to a load balance server. The stack trace is given below. Any help would be appreciated
[FileNotFoundException: Could not load file or assembly 'App_Web_ujlndqyx, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.]
System.RuntimeTypeHandle._GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, Boolean loadTypeFromPartialName) +0 System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) +54 System.RuntimeType.PrivateGetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) +39 System.Type.GetType(String typeName, Boolean throwOnError) +60 System.Web.UI.ObjectStateFormatter.DeserializeType(SerializerBinaryReader reader) +201 System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +955 System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +395 System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +205 System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +218 System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +205 System.Web.UI.ObjectStateFormatter.Deserialize(Stream inputStream) +163[ArgumentException: The serialized data is invalid.]
System.Web.UI.ObjectStateFormatter.Deserialize(Stream inputStream) +228 System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +303 System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState) +5 System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState) +37 System.Web.UI.HiddenFieldPageStatePersister.Load() +116[ViewStateException: Invalid viewstate. Client IP: 114.130.35.83 Port: 2161 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 ViewState: /wEPDwUJMzI0MDgwMzY4DxYCHgtDdXJyZW50VmlldwspbE9yZGVySm91cm5leURlZmF1bHQrQ3VycmVudFZpZXdFbnVtLCBBcHBfV2ViX3VqbG5kcXl4LCBWZXJzaW9uPTAuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbAIWAmYPZBYCAgMPZBYGAgMPFgIeCWlubmVyaHRtbAXSBDx1bD4KPGxpPjxhIGNsYXNzPSJzZWxlY3RlZCIgaHJlZj0iaHR0cHM6Ly9idXNpbmVzcy5idC5jb20vIj5CdXNpbmVzcyBob21lPC9hPjwvbGk+CjxsaSBjbGFzcz0iaGFzX2Ryb3BfZG93biBzZWxlY3RlZCI+IDxhIGhyZWY9Imh0dHBzOi8vYnVzaW5lc3MuYnQuY29tL3Byb2R1Y3RzLWFuZC1zZXJ2aWNlcy8iPlByb2R1Y3RzICZhbXA7IHNlcnZpY2VzPC9hPiA8YSBjbGFzcz0iZHJvcF9kb3duIiBocmVmPSIjZm9vdGVyIj5WaWV3IHByb2R1Y3RzIGFuZCBzZXJ2aWNlcyAocG9wLXVwKTwvYT4gPC9saT4KPGxpPjxhIGhyZWY9Imh0dHBzOi8vYnVzaW5lc3MuYnQuY29tL3BhY2thZ2VzLyI+UGFja2FnZXM8L2E+PC9saT4KPGxpPjxhIGhyZWY9Imh0dHA6Ly93d3cuaW5zaWdodC5idC5jb20vIj5CdXNpbmVzcyBpbnNpZ2h0PC9hPjwvbGk+CjxsaT48YSBocmVmPSJodHRwczovL3d3dy5idC5jb20vY21wL3B1YmxpYy9odWIuZG8iPllvdXIgYWNjb3VudD...]
[HttpException (0x80004005): The state information is invalid for this page and might be corrupted.]
System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +118 System.Web.UI.ViewStateException.ThrowViewStateError(Exception 开发者_运维技巧inner, String persistedState) +13 System.Web.UI.HiddenFieldPageStatePersister.Load() +222 System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +107 System.Web.UI.Page.LoadAllState() +43 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6230 System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +247 System.Web.UI.Page.ProcessRequest() +79 System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +23 System.Web.UI.Page.ProcessRequest(HttpContext context) +111 ASP.toj_application_orderjourney_default_aspx.ProcessRequest(HttpContext context) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\82a64fa9\62e4fa0\App_Web_fewmyzsj.0.cs:0 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +406 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +76
Move the class you put in viewstate in a separate assembly, not in the web project assembly. If you don't, on the fly compilation of aspx code will produce temp names, different for all web servers
I had the same problem but managed to cure it now. We are running a web farm with 2 servers. Machine keys match. I think my problem is related to using Oracle's session state software. When I put any object, a simple list, in the viewstate things go awry. I get this error as soon as it serves a post back on the other server than the original get was served.
Two interesting items I noticed:
the name of the file it cannot find when serving request on server A, does not exist on server A, however it is the name of the file on server B. The difference in the file names is the hash it adds at the end,
App_Web_form_create_excel_data_template.aspx.cdcab7d2.wpiiisfb
on server A and
App_Web_form_create_excel_data_template.aspx.cdcab7d2.lkw6qbsg.dll
on server B. The .compile files on each respective server points to the correct file.
the session state oracle stores in the oracle database becomes corrupt and unusable. Its lock column gets a 1 in it that never clears. I must either delete the row or delete the asp.net session cookie from the browser.
I then found the solution thanks to the Microsoft KB article Troubleshooting the "View state is invalid" error with ASP.NET.
I had declared a variable as an enum and saved it in viewstate. I am assuming enum is considered a dynamic class and so as the article states the name of the source file is used in the serialization of the viewstate item that was the enum! Since the names of the source files are different on the 2 web servers that make up the farm when it serialized its value on one server and tried to deserialize its value on the other the error occurred!
Your Inner Exception is about ViewState
but about file not found exception:
[FileNotFoundException: Could not load file or assembly 'App_Web_ujlndqyx, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.]
This means that your server tried to resolve some class type, and didn't find anything corresponding. Try to check this:
- I think that you've linked some library in your project, and have deployed it on one machine, but not to your server.
- Maybe some dll from GAC is missing
- Maybe IIS settings for the .NET version is different from your local machine or you simply running the application on the machine with different .NET version
精彩评论