使用IIS URL重写与ASP.NET更新面板导致错误

Ral*_*ner 5 asp.net iis updatepanel arr

这个问题跟问题15632722有点:"出站规则不适用于updatepanel".

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

有几条规则在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>
Run Code Online (Sandbox Code Playgroud)

我的假设是,当重写响应时,返回的Content-Length的差异导致UpdatePanel的javascript在解析响应并将其转储到页面时失败.不幸的是,我对于UpdatePanels如何工作以确定究竟发生了什么的内部知识还不够了解.

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