当.NET 4.5 Framework仅安装在负载均衡器后面的一个服务器中时,ASP.NET EventValidation会失败 [英] ASP.NET EventValidation fails when .NET 4.5 Framework is installed in only one server behind the load balancer

查看:400
本文介绍了当.NET 4.5 Framework仅安装在负载均衡器后面的一个服务器中时,ASP.NET EventValidation会失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经在我们的网络服务器中安装了.net 4.5 Framework。我们的应用程序针对.net 4.0,并运行在负载均衡器后面的多个服务器。

We have installed .net 4.5 Framework in one of our web servers. Our applications are targeted for .net 4.0 and run off multiple servers behind a load balancer.

安装后,我们得到一些POST请求的以下错误消息

After the installation we get the following error message for some POST requests

error_name = System.ArgumentException
error_message =无效的回发或回调参数。在页面中的配置或<%@ Page EnableEventValidation =true%>中启用事件验证。出于安全性考虑,此功能验证回发或回调事件的参数是否来自最初呈现它们的服务器控件。如果数据有效且预期,请使用ClientScriptManager.RegisterForEventValidation方法为了注册回发或回调数据进行验证。
error_details = Source:System.Web

error_name=System.ArgumentException error_message=Invalid postback or callback argument. Event validation is enabled using in configuration or <%@ Page EnableEventValidation="true" %> 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. error_details=Source: System.Web

当使用.net 4.5安装从服务器请求时,请求正文中的__EVENTVALIDATION值不同。 MSDN提到,.net 4.5中的加密更改使用opt in配置,因此默认情况下它应该是向后兼容的。

The __EVENTVALIDATION value in the body of the request is different when it is requested from server with .net 4.5 installation. MSDN mentions that cryptography changes in .net 4.5 uses opt in configuration, so by default it should be backward compatible.

有没有配置更改,没有禁用事件验证,我需要做的是_EVENTVALIDATION在安装.net 4.5的机器上的行为相同,因为它只与.net 4.0?

Is there a config change, without disabling event validation, I need to do for _EVENTVALIDATION to behave the same on machines with .net 4.5 installed as it behaves with only .net 4.0 ?

推荐答案

我有同样的问题,因为我们目前正在将服务器群从2003年迁移到Windows 2012 (.NET 4.0)。查看ClientScriptManager,事件验证代码已发生了很大的变化。

I had the same issue as we are currently migrating our server farm to Windows 2012 (.NET 4.5) from 2003 (.NET 4.0). Looking into the ClientScriptManager, the event validation code has changed considerably.

修复此问题的方法是添加appSetting以使用传统事件验证兼容性此处

A fix for this was to add the appSetting to use Legacy Event Validation compatibility as described here

<appSettings>
  <add key="aspnet:UseLegacyEventValidationCompatibility" value="true" />
</appSettings>

现在为我的页面中的事件验证生成的值是相同的,无论是由.NET 4.0还是4.5生成的

Now the values generated for event validation in my pages are the same whether generated by .NET 4.0 or 4.5

这篇关于当.NET 4.5 Framework仅安装在负载均衡器后面的一个服务器中时,ASP.NET EventValidation会失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆