繁体   English   中英

URL 使用子域在 IIS 7.0 上重写问题,在 IIS 7.5 上不存在

[英]URL Rewrite issues on IIS 7.0 with subdomains, not present on IIS 7.5

我正在构建这个需要几个子域的 asp.net 应用程序。 它们都将共享相同的代码库,但我在其自己的子文件夹中为每个子域都有单独的.aspx,如下所示:

admin.domain.com -> domain.com/admin
user.domain.com -> domain.com/user
...

使用以下重写规则,在我的开发盒(win7、iis 7.5)上一切正常:

<rule name="admin.domain.com" stopProcessing="true">
   <match url=".*" />
      <conditions>
        <add input="{HTTP_HOST}" pattern="^admin.domain.com$" />
        <add input="{PATH_INFO}" pattern="^/images/" negate="true" />
        <add input="{PATH_INFO}" pattern="^/handlers/" negate="true" />
        <add input="{PATH_INFO}" pattern="^/aspnet_client/" negate="true" />
        <add input="{PATH_INFO}" pattern="^/webservices/" negate="true" />
        <add input="{URL}" pattern="\.axd$" negate="true" />
      </conditions>
      <action type="Rewrite" url="\admin\{R:0}" />
</rule>

当我在 IIS 7.0 上将我的版本推送到运行 Win 2008 R1 的生产时,重写中断。 我看到页面源中的<form>标记指向action="admin/" ,而在 7.5 上它指向 root。 因此,当我发布 forms 时,我得到 404,因为每次重写都没有 /admin 子文件夹。

我能做些什么来解决这个问题吗? 我想省略升级到 R2 来解决这个问题。 我可以单独升级 URL Rewrite 模块吗? 我可以使用不同的重写规则来解决这个问题吗?

任何帮助表示赞赏!

由于某种原因,我在 iis 7.0 上找到了一个解决方案,您必须在定义表单的地方添加以下内容。 就我而言,它是我的母版页中的 Page_Load。 希望这可以帮助。

form1.Action = Request.RawUrl

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM