2012-03-02 27 views
2

我有一個定義了自定義httpmodule的web服務。我試圖將這個web服務啓動到運行IIS7的生產服務器上,但只能使它在Classic模式下運行。IIS7將web.config從經典遷移到集成問題

我已經試過移動本節

<system.web> 
<httpModules> 
    <add name="BasicAuthenticationModule" type="MyProject.UserAuthenticator.UserNameAuthenticator" /> 
</httpModules> 
... 

到system.webserver部分,像這樣:

<system.webServer> 
<modules runAllManagedModulesForAllRequests="true"> 
    <add name="BasicAuthenticationModule" type="MyProject.UserAuthenticator.UserNameAuthenticator" /> 
</modules> 

當我嘗試這個IE給了我這個錯誤:

Config Error 
    Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to   
    'BasicAuthenticationModule' 

我也試圖用下面的DOS命令自動遷移:

appcmd migrate config "mysite/" 

而得到這個消息發回:

The module BasicAuthenticationModule with type "mytype" is already present in the application with a different type"", and was not migrated 

我不是IIS專家,所以任何見解表示讚賞。


所以經過一些研究,看起來已經有一個名爲BasicAuthenticationModule的本地模塊。我可以通過重命名模塊「BasicCustomAuthenticationModule」來消除我的問題。這是正確的方法還是應該刪除另一個?

謝謝! AFrieze

回答

5

他們是名爲BasicAuthenticationModule的衝突。解決方案是重命名模塊。

<httpModules> 
    <add name="BasicCustomAuthenticationModule" type="MyProject.UserAuthenticator.UserNameAuthenticator" /> 
</httpModules> 


    <system.webServer> 
<validation validateIntegratedModeConfiguration="false"/> 
<modules runAllManagedModulesForAllRequests="true"> 
    <add name="BasicCustomAuthenticationModule" type="MyProject.UserAuthenticator.UserNameAuthenticator" /> 
</modules>