2008-12-12 59 views
31

我在IIS7(Vista)上使用ASP.net和.NET 3.5一起使用來自Microsoft的URL重寫模塊。asp.net,url重寫模塊和web.config

這意味着,我必須在web.config中的

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

部分,但我得到一個警告,即system.webServer中的元素「重寫」是不允許的。

如何配置我的系統以允許(甚至可能有Intellisense)在web.config的重寫部分?

謝謝 克里斯托夫

+3

我可以確認這個問題仍然發生在VS2010和IIS7.5中。 – 2010-05-18 09:36:43

+1

這會導致構建我的mvc項目失敗。很糟糕。 – 2011-04-18 04:50:18

回答

25

我能得到這個工作在Visual Studio 2010

開始與魯斯蘭的帖子here並下載2.0智能感知文件。然後,只需按照他先前發佈的指示here。所有我落得這樣做運行以下命令魯斯蘭指示:

C:\download_directory\rewrite2_intellisense>cscript UpdateSchemaCache.js

正如克里斯托弗在他的評論中指出的,請務必在UpdateSchemaCache.js與VS100COMNTOOLS取代VS90COMNTOOLS如果你運行上面的命令之前使用Visual Studio 2010.

我不需要重新啓動Visual Studio。我將<rewrite>部分僅添加到適用的Web.config轉換文件中,因爲它在主Web.config中打破了本地調試。

3

我相信你需要有重寫模塊「已安裝」您的系統上的web.config文件中的URL。

您或者需要通過IIS 7.0界面在您的應用程序上安裝模塊,或讓您的託管公司爲您做。

+0

nope,我通過Web平臺安裝程序2.0和IIS.net的本地安裝程序在幾個Mashines(Vista和Win7)上安裝了幾次重寫模塊 – Christoph 2009-05-22 14:58:45

3

我相信你需要定義模塊在你的web.config這樣的:

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

更新:智能感知可以設置在這裏:

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

更新:驗證在%systemroot%\ system32 \ inetsrv \ config \ applicationHost.config中標識sectionGroup:

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

嗨, 我實際上有這個(用於重寫2 ,.0):

< NAME = 「outboundRules」 overrideModeDefault = 「允許」/> <段名= 「提供者」 overrideModeDefault = 「允許」/> <段名= 「rewriteMaps」 overrideModeDefault = 「允許」/> 但問題依然存在... – Christoph 2009-12-03 10:14:41