2010-04-12 19 views
1

對於web.config的system.web/httpHandlers部分,我可以使用「configSource」屬性來指定外部配置文件,如下所示:從web.config中爲IIS7分離處理程序配置(configSource不受支持?)

<system.web> 
    <httpHandlers configSource="App_Config\httpHandlers_iis6.config" /> 
</system.web> 

這使我可以在所有環境中使用同一組處理程序,而只需將它們保持在一個位置,同時仍允許像appSettings這樣的事件從一個web.config更改爲下一個。

不幸的是,它似乎是相同的技術是支持部分有關IIS7處理程序:

<system.webServer> 
    <handlers configSource="App_Config\httpHandlers_iis7.config" /> <!-- not supported --> 
</system.webServer> 

有什麼辦法從IIS7的主要web.config文件分開我的處理程序配置?

+0

我也想知道這一點。儘管理由有點不同。我想在64位上爲IIS7.5創建一個部分,爲IIS7.5 32位創建一個。 – 2010-12-02 04:51:56

回答

4

啊 - 我明白了。

下面是從web.config我行:

<handlers configSource="App_Config\Handlers.xml" /> 

不是\而不是/(我被抓住了那裏)

,在我的外部文件我有:

<handlers accessPolicy="Read, Write, Script, Execute"> 
      <remove name="WebServiceHandlerFactory-Integrated"/> 
      <remove name="ScriptHandlerFactory"/> 


      <remove name="ScriptHandlerFactoryAppServices"/> 

    ... 
    ... 
    ... 
       <add verb="GET,HEAD,POST" preCondition="integratedMode" name="SpellChecker" path="GoogleSpellChecker.ashx" type="umbraco 

.presentation.umbraco_client.tinymce3.plugins.spellchecker.GoogleSpellChecker,umbraco"/> 
      <add verb="POST,GET,HEAD" name="Elmah" path="/umbraco/elmah.axd" type="Westfield.Web.Application.SecureErrorLogPageFactory, Westfield.Web"/> 
     </handlers> 

它的工作:)

希望這可以幫助別人。

+0

你描述的不適合我。 system.webServer/handlers元素不支持「configSource」屬性。 – 2010-12-03 16:24:24

+1

嗨大衛。在我的Web.config VS2010中強調了configsource屬性,表示它不能識別它,但我可以向你保證它對我有效。我想重新迭代,確保你使用反斜槓,而不是正斜槓(這讓我)。 – 2010-12-08 12:01:38

+0

所以我忽視它,當它告訴我它不識別屬性 – 2010-12-08 12:02:22

相關問題