这个问题跟Question 15632722: "Outbound rules don't apply inside updatepanel"有点关系 .

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

有一些规则可以在从IIS到"fix" 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如何工作以确定究竟发生了什么的内部知识还不够了解 .

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