Search code examples
iis-7moduleiis-6httpmodule

IIS7 Migrate web.config from classic to integrated issue


I have a webservice which defines a custom httpmodule. I am attempting to launch this webservice onto a production server running IIS7 but have only been able to get it to run in Classic mode.

I have tried moving this section

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

To the system.webserver section like so:

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

When I try this IE gives me this error:

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

I also attempted to migrate automatically with the following DOS command:

  appcmd migrate config "mysite/"

And get this message back:

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

I am not an IIS expert so any insights are appreciated.


So after a little research it appears there is already a native module called BasicAuthenticationModule. I can eliminate my issue by renaming my module "BasicCustomAuthenticationModule." Is this the correct approach or should I be removing the other one?

Thanks! AFrieze


Solution

  • Their was a conflict in the name BasicAuthenticationModule. The solution was to rename the module.

    <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>