8

Earlier I wanted to keep the redirects out of web.config, because I have many rewrite rules. I was successfull in doing that by using

<rewrite>      
      <rules configSource="RewriteRules.config" />
</rewrite>

Now the problem is this file is already having many rules, and I am going to use another set of large amount of rules for another domain pointed to same base code. So I want to keep rules for both files on different files like:-

<rewrite>      
          <rules configSource="RewriteRules_a.config" />
          <rules configSource="RewriteRules_b.config" />
</rewrite>

which is not allowed, can anyone suggest how can i fix this situation?? Please note both domains will have different rules and domain addition can be more too in this project.

Any suggestions will be appreciated ...

4

1 回答 1

1

您可以使用创建多个文件(仅用于开发)并创建将它们全部连接到单个 rewrite.config 文件中的构建后规则吗?

这样,您可以将它们拆分为多个文件并在开发过程中对其进行版本控制,并且后期构建会将它们聚合到一个文件中以用于生产目的。

第二个域是否指向 IIS 中的同一个应用程序?如果它们是不同的应用程序,您可以使用 VS 的配置转换功能为每个域创建一个文件,并且只在每个应用程序上部署您需要的文件: http ://www.hanselman.com/blog/SlowCheetahWebconfigTransformationSyntaxNowGeneralizedForAnyXMLConfigurationFile.aspx

于 2013-03-29T17:41:36.637 回答