net, url重写模块和web.config

时间:2021-11-07 11:28:06

i'm using ASP.net with .NET 3.5 on IIS7 (Vista) with the URL Rewrite Module from Microsoft.

我在IIS7 (Vista)上使用ASP.net和。net 3.5以及微软的URL重写模块。

This means, that i have a

这意味着,我有一个。

<system.webServer>
    <rewrite>...</rewrite>
    ...
</system.webServer>

section within the web.config, but i get a warning, that within the system.webServer the element "rewrite" is not allowed.

在web部分。配置,但是我得到一个警告,在系统内部。不允许“重写”元素。

How can i configure my system to allow (and maybe even have Intellisense) on the rewrite-part of the web.config?

我如何配置我的系统以允许(甚至可能有智能感知)在web.config的重写部分?

Thank you Christoph

谢谢Christoph

3 个解决方案

#1


25  

I was able to get this working in Visual Studio 2010.

我可以在Visual Studio 2010中使用它。

Start with Ruslan's post here and download the 2.0 IntelliSense file. Then, just follow the directions he posted previously here. All I ended up doing was running the following command as Ruslan instructs:

从Ruslan的文章开始,下载2.0 IntelliSense文件。然后,按照他之前在这里发布的说明去做。我最后所做的就是按照Ruslan的指示运行以下命令:

C:\download_directory\rewrite2_intellisense>cscript UpdateSchemaCache.js

C:\ download_directory \ rewrite2_intellisense > cscript UpdateSchemaCache.js

As Christoph points out in his comment, make sure you replace VS90COMNTOOLS with VS100COMNTOOLS in UpdateSchemaCache.js before running the above command if you are using Visual Studio 2010.

正如Christoph在他的评论中指出的,请确保在UpdateSchemaCache中使用VS100COMNTOOLS来替换VS90COMNTOOLS。如果您正在使用Visual Studio 2010,请在运行上述命令之前运行js。

I did not need to restart Visual Studio. I added the <rewrite> section only to the applicable Web.config transformation files, as having it in the main Web.config breaks local debugging.

我不需要重新启动Visual Studio。我只在适用的Web上添加了 部分。配置转换文件,如在主Web中。配置本地调试。

#2


3  

I believe you need to have the URL Rewrite Module "installed" within the web.config file on your system.

我认为您需要在web中“安装”URL重写模块。系统上的配置文件。

You either need to install the module on your application via the IIS 7.0 interface or have your hosting firm do it for you.

您要么需要通过IIS 7.0接口在应用程序上安装模块,要么让托管公司为您安装模块。

#3


3  

I believe you need to define the module in your web.config like this:

我认为您需要在web中定义模块。配置是这样的:

<system.webServer>
    <modules>
        <add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" />
    </modules>
</system.webServer>

Update: Intellisense can be setup here:

更新:智能感知可以在这里设置:

http://ruslany.net/2009/08/visual-studio-xml-intellisense-for-url-rewrite-1-1/

http://ruslany.net/2009/08/visual-studio-xml-intellisense-for-url-rewrite-1-1/

Update: Verify that the sectionGroup is identified in %systemroot%\system32\inetsrv\config\applicationHost.config:

更新:验证sectionGroup是否在%systemroot%\system32\inetsrv\config\ \ \config applicationHost.config .config中标识。

<sectionGroup name="rewrite">
    <section name="rules" overrideModeDefault="Allow" />
    <section name="globalRules" overrideModeDefault="Deny" allowDefinition="AppHostOnly" />
    <section name="rewriteMaps" overrideModeDefault="Allow" />
</sectionGroup>

#1


25  

I was able to get this working in Visual Studio 2010.

我可以在Visual Studio 2010中使用它。

Start with Ruslan's post here and download the 2.0 IntelliSense file. Then, just follow the directions he posted previously here. All I ended up doing was running the following command as Ruslan instructs:

从Ruslan的文章开始,下载2.0 IntelliSense文件。然后,按照他之前在这里发布的说明去做。我最后所做的就是按照Ruslan的指示运行以下命令:

C:\download_directory\rewrite2_intellisense>cscript UpdateSchemaCache.js

C:\ download_directory \ rewrite2_intellisense > cscript UpdateSchemaCache.js

As Christoph points out in his comment, make sure you replace VS90COMNTOOLS with VS100COMNTOOLS in UpdateSchemaCache.js before running the above command if you are using Visual Studio 2010.

正如Christoph在他的评论中指出的,请确保在UpdateSchemaCache中使用VS100COMNTOOLS来替换VS90COMNTOOLS。如果您正在使用Visual Studio 2010,请在运行上述命令之前运行js。

I did not need to restart Visual Studio. I added the <rewrite> section only to the applicable Web.config transformation files, as having it in the main Web.config breaks local debugging.

我不需要重新启动Visual Studio。我只在适用的Web上添加了 部分。配置转换文件,如在主Web中。配置本地调试。

#2


3  

I believe you need to have the URL Rewrite Module "installed" within the web.config file on your system.

我认为您需要在web中“安装”URL重写模块。系统上的配置文件。

You either need to install the module on your application via the IIS 7.0 interface or have your hosting firm do it for you.

您要么需要通过IIS 7.0接口在应用程序上安装模块,要么让托管公司为您安装模块。

#3


3  

I believe you need to define the module in your web.config like this:

我认为您需要在web中定义模块。配置是这样的:

<system.webServer>
    <modules>
        <add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" />
    </modules>
</system.webServer>

Update: Intellisense can be setup here:

更新:智能感知可以在这里设置:

http://ruslany.net/2009/08/visual-studio-xml-intellisense-for-url-rewrite-1-1/

http://ruslany.net/2009/08/visual-studio-xml-intellisense-for-url-rewrite-1-1/

Update: Verify that the sectionGroup is identified in %systemroot%\system32\inetsrv\config\applicationHost.config:

更新:验证sectionGroup是否在%systemroot%\system32\inetsrv\config\ \ \config applicationHost.config .config中标识。

<sectionGroup name="rewrite">
    <section name="rules" overrideModeDefault="Allow" />
    <section name="globalRules" overrideModeDefault="Deny" allowDefinition="AppHostOnly" />
    <section name="rewriteMaps" overrideModeDefault="Allow" />
</sectionGroup>