5

这个问题与问题 15632722 中的一些内容有关:“Outbound rules don't apply inside updatepanel”

我有一个通过 IIS 应用程序请求路由作为反向代理向公众公开的 Web 应用程序。

有几条规则可以在离开 IIS 的过程中重写内容以“修复”URL 以适应反向代理设置。除了使用<asp:UpdatePanel>.

在成功获取要根据需要重写的 UpdatePanel 的内容后,包含 UpdatePanel 的页面开始产生以下 javascript 错误:

Uncaught Sys.WebForms.PageRequestManagerParserErrorException: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled. Details: Error parsing near [HTML_Specific Details Omitted]

作为参考,URL 重写规则之一是:

<rule name="ReverseProxyOutboundRule Data Api - Relative" preCondition="ResponseIsHtml">
    <match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script, CustomTags" customTags="Custom" pattern="^/([^/].*)" negate="false" />
    <action type="Rewrite" value="/data/{R:1}" />
    <conditions>
        <add input="{URL}" pattern="^/data/.*" />
    </conditions>
</rule>

<preConditions>
    <preCondition name="ResponseIsHtml" logicalGrouping="MatchAny">
        <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/[html|plain]" />
</preCondition>

我的假设是,当响应被重写时,返回的 Content-Length 的差异导致 UpdatePanel 的 javascript 在解析响应并将其转储到页面时失败。不幸的是,我对 UpdatePanels 如何工作的内部原理了解得不够多,无法准确地弄清楚发生了什么。

我怎样才能避免这个错误?

4

0 回答 0