使用 loadbalancer 和 webgate 时回发或回调参数无效

Invalid postback or callback argument when using loadbalancer and webgate

您好,我开发了一个部署在两台服务器上的 asp.net 网站。当我使用 URL 中服务器的 IP 地址(如 https://123.123.123.12/Pagename.aspx. When I access site using loadbalancer DNS name (https://DNSName/Pagename.aspx)和 Webgate 访问该站点时,该站点工作正常,某些页面抛出以下异常

"Invalid postback or callback argument" 或 "The serialized data is invalid."

这是间歇性发生的。那是同一个页面,有时会显示正确的数据,有时会抛出异常。

当我在其中一台服务器上停止网站 (IIS) 时,所有页面都正常工作,没有抛出上述异常。

我还在两台服务器上验证了机器密钥,两台服务器上的机器密钥值相同。同一台服务器上的其他网站与负载平衡器 DNS URL (//DNSName/Pagename.aspx) 和 webgate.

一起工作正常

有人可以帮我解决这个问题吗?

下面是 StackTrace

<Description>An exception of type 'System.ArgumentException' occurred and was caught.</Description>
  <ExceptionType>System.ArgumentException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
  <Message>Invalid postback or callback argument.  Event validation is enabled using &lt;pages enableEventValidation="true"/&gt; in configuration or &lt;%@ Page EnableEventValidation="true" %&gt; in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.</Message>
  <Source>System.Web</Source>
  <HelpLink />
  <Property name="ParamName">&lt;undefined value&gt;</Property>
  <Property name="Data">System.Collections.ListDictionaryInternal</Property>
  <Property name="TargetSite">Void ValidateEvent(System.String, System.String)</Property>
  <Property name="HResult">-2147024809</Property>
  <StackTrace>   at System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument)
   at System.Web.UI.WebControls.HiddenField.LoadPostData(String postDataKey, NameValueCollection postCollection)
   at System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)</StackTrace>

经过大量研究,我发现两台服务器都没有 windows 更新(可能缺少一些补丁)。在两台机器上执行 windows 更新后,即使使用负载平衡器 DNS,我的网站也开始正常工作。

是的,这让我们很头疼。 底线是在 IIS 网络场中,保持所有服务器完全相同,OS 补丁,尤其是 .net 框架。对于 .net 框架,请使用 regedit 检查,因为 IIS 应用程序池报告不正确。 如果它们不完全相同(包括 OS 个补丁),请准备好应对会话管理方面的此类麻烦。