IIS7将web.config从经典迁移到集成问题

AFr*_*eze 2 iis-7 iis-6 module httpmodule

我有一个定义自定义httpmodule的web服务.我正在尝试将此Web服务启动到运行IIS7的生产服务器上,但只能使其在经典模式下运行.

我试过移动这一节

 <system.web>
<httpModules>
  <add name="BasicAuthenticationModule" type="MyProject.UserAuthenticator.UserNameAuthenticator" />
</httpModules>
...
Run Code Online (Sandbox Code Playgroud)

像这样的system.webserver部分:

  <system.webServer>
<modules runAllManagedModulesForAllRequests="true">
  <add name="BasicAuthenticationModule" type="MyProject.UserAuthenticator.UserNameAuthenticator" />
</modules>
Run Code Online (Sandbox Code Playgroud)

当我尝试这个IE给我这个错误:

  Config Error
  Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to          
  'BasicAuthenticationModule' 
Run Code Online (Sandbox Code Playgroud)

我还尝试使用以下DOS命令自动迁移:

  appcmd migrate config "mysite/"
Run Code Online (Sandbox Code Playgroud)

并收到此消息:

  The module BasicAuthenticationModule with type "mytype" is already present in the application with a different type"", and was not migrated
Run Code Online (Sandbox Code Playgroud)

我不是IIS专家,所以任何见解都表示赞赏.


因此,经过一些研究后,似乎已经存在一个名为BasicAuthenticationModule的本机模块.我可以通过重命名我的模块"BasicCustomAuthenticationModule"来消除我的问题.这是正确的方法还是应该删除另一个?

谢谢!AFrieze

AFr*_*eze 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>
Run Code Online (Sandbox Code Playgroud)