2011-09-08 97 views
1

我們在使用IIS 6的Windows Server 2003上使用我們的網站,並且還使用IIS 5測試服務器2003. 當我在測試服務器上使用ViewState測試頁面時,它工作正常。但是我們在運行IIS 6的其他服務器上測試過。它給出了錯誤。我比較了web configuratioin文件,它看起來是一樣的。視圖狀態有機器密鑰和最大長度。我花了幾天時間,仍然沒有找到它。有人可以幫助我。ViewState問題

這個錯誤不會一直髮生。所以我認爲源代碼不是問題。 這裏是我的錯誤

[SerializationException: Member '_name' was not found.] 
    System.Runtime.Serialization.SerializationInfo.GetElement(String name, Type& foundType) +7608149 
    System.Runtime.Serialization.SerializationInfo.GetString(String name) +24 
    SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2..ctor(SerializationInfo info, StreamingContext context) +69 
    PV.Data.Standard.EntityClasses.ClinicEntity..ctor(SerializationInfo info, StreamingContext context) +26 

[TargetInvocationException: Exception has been thrown by the target of an invocation.] 
    System.RuntimeMethodHandle._SerializationInvoke(Object target, SignatureStruct& declaringTypeSig, SerializationInfo info, StreamingContext context) +0 
    System.Reflection.RuntimeConstructorInfo.SerializationInvoke(Object target, SerializationInfo info, StreamingContext context) +108 
    System.Runtime.Serialization.ObjectManager.CompleteISerializableObject(Object obj, SerializationInfo info, StreamingContext context) +273 
    System.Runtime.Serialization.ObjectManager.FixupSpecialObject(ObjectHolder holder) +49 
    System.Runtime.Serialization.ObjectManager.DoFixups() +223 
    System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage) +188 
    System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage) +203 
    System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream) +12 
    System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +968 
    System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +291 
    System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +392 
    System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +404 
    System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +392 
    System.Web.UI.ObjectStateFormatter.Deserialize(Stream inputStream) +135 

[ArgumentException: The serialized data is invalid.] 
    System.Web.UI.ObjectStateFormatter.Deserialize(Stream inputStream) +199 
    System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +297 
    System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState) +4 
    System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState) +37 
    System.Web.UI.HiddenFieldPageStatePersister.Load() +113 

[ViewStateException: Invalid viewstate. 
    Client IP: 10.0.51.92 
    Port: 51267 
    User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; BRI/1) 
    ViewState: /wEPDwUJODUyMDU5NzIxDxYOHgpQcmFjdGljZVBrKClYU3lzdGVtLkd1aWQsIG1zY29ybGliLCBWZXJzaW9uPTIuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OSRlMzE4OTAzNy0xOWY3LWRmMTEtOGQwNC0wMDFlMGI2ZTE4MWEeCENsaW5pY1BrKCsEJGQyYzg3OWI4LTE5ZjctZGYxMS04ZDA0LTAwMWUwYjZlMTgxYR4IUHJhY3RpY2UFBFBDTFAeBkNsaW5pYwUKVy4gUk9CSU5TTx4M..] 

[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) +106 
    System.Web.UI.ViewStateException.ThrowViewStateError(Exception inner, String persistedState) +14 
    System.Web.UI.HiddenFieldPageStatePersister.Load() +217 
    System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +105 
    System.Web.UI.Page.LoadAllState() +43 
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6785 
    System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242 
    System.Web.UI.Page.ProcessRequest() +80 
    System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21 
    System.Web.UI.Page.ProcessRequest(HttpContext context) +49 
    ASP.clinicinfo_aspx.ProcessRequest(HttpContext context) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\9ca5f508\2be4cd8e\App_Web_sqt6xlmv.2.cs:0 
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181 
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75 
+0

不同的數據庫?不看與ViewState相關。 – bzlm

+0

你在代碼中的視圖狀態是怎麼樣的?我感覺到詭計和碎片。你能夠顯示任何你的代碼嗎?如果您在配置中關閉ViewState的最大長度,會發生什麼? –

+0

無論我是否放置最大值,它都是一樣的。 – keum

回答

0

我想這是太明顯地說,您的測試服務器可能成爲它的目的更好,如果它跑在同一個版本的Windows和IIS您的生產服務器使用......(所以這是實際上有一個建議......)

否則,如果沒有深入研究可能導致此問題的所有可能的問題,則可以在IIS6中使用IIS5兼容模式。

  1. R-點擊IIS管理器中的網站
  2. 服務
  3. 複選標記的IIS 5.0隔離模式複選框
0

是否已經SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2類曾有一個成員叫_name?這裏涉及負載平衡嗎?

看起來像ViewState是在類型爲SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2的類有一個_name_ member, and then the ViewState is being interpreted on a machine where that class does not have a _name成員的機器上創建的。

+0

如果_name成員不存在,則錯誤必須始終發生。但我的問題是,它有時會發生,有時不會發生。 – keum

+0

請編輯您的問題以包含此事實,並且請包含您在'_name'變量不存在時看到的完整例外情況。 –