I moved my project from windows server 2003 IIS 6 to 2008 IIS 7 and the following error came up.
Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'ASPxHttpHandlerModule'
When I remove this entry the site runs but then the Controls dont work.
When I Add the following <remove name="ASPxHttpHandlerModule" /> the controls work but my site then keeps popping Up Java Script errors. Example: MSIE is undefined. This is a browser check .
Think you get the point.
Attached is a sample of my Web.Config.
Cannot add a sample project.
I Did work through that and nothing worked.
Maybe to give you an Idea of how my site works.
We are working with Mapguide Opensource.
I have one site that opens a window. This window contains two frames.
One points to another virtual directory outside my current site. ( This is the MapFrame )
The other frame contains Buttons that opens up a window from my current site.
See screenshot attached.
Yellow block is my MapFrame
Purple Block is just a normal frame that contains buttons to open up Search Pages for the map. But the search page points back to my current site.
Also attached is that page.
Line: 94 is the Frame that points to a virtual directory outside my current site.
The right Frame is designed in maestro that points to a page we design. That page only contains java script functions that opens up the window.
The thing that bugs me as that the same setup was done on Server 2003 IIS 6 with no issues. Took the site from that server to the 2008 server IIS7. And I got this problem.
Worked all weekend but at least I had a break through.
Thought I would let you know in case someone else will struggle with this. I dont know how this works , you will have more understanding of this. If you could explain maybe why this happens.
So. The site we are working on must be set up to be used on the internet.
IT created the Default Website in IIS to point directly to my site.
Like I explained. When the map opens , one of the frames point to another virtual directory set up.
So what they did is they created another virtual directory inside the subfolder of the map virtual directory.
So now my site had two virtual directorys setup.
When I changed my default site path to one folder back the problem dissapeared.
I dont know how this works. Is it because when I run http://localhost/mapguide/Sitename it actually runs http://localhost at the same time.
So the problem was that the site in actual fact had two web.configs.
Now I just have to figure out how to run my site without having to create the second virtual directory.
Attached is the Wrong setup of my IIS. Just to show you what it looks like. Explaining this is a bit hard.
Still .. Why it works like that in IIS 6 and not in IIS 7 is still a mystery.
Thanks anyway .
Hi De Wet:
Thank you for this great work! Now the problem is clear.
If you have two web.config files and each file contains the HttpHandlerModule, then this error is expected. We recommend to register it only once.
The difference in behavior between IIS6 and IIS7 is caused by the way how these servers reqister HttpHandlers.
You can learn more about these differences here: