Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot add duplicate collection entry of type 'filter' with unique key attribute 'name' set to 'ASP.Net_4.0_64bit'

I have been running into this issue for quite some time. It occurs when I open up an asp.net page pointing to my localhost. I am running windows 2008 r2 with visual studio 2012 and iis 7.5.

The config source that it shows is this. :

 1451:                 <remove name="ASP.NET_4.0.30319.0" />
 1452:                 <filter name="ASP.Net_4.0_64bit" path="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_filter.dll" enableCache="true" preCondition="runtimeVersionv4.0,bitness64" />
 1453:                 <filter name="ASP.Net_4.0_32bit" path="C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_filter.dll" enableCache="true" preCondition="runtimeVersionv4.0,bitness32" />

It shows it is erroring on line 1452.

Initially, it was an issue in the applicationHost.config file in the inetsrv 32 and 64bit locations. I went in and removed the duplicate 4.0 entry and it worked for a good couple of months.

It then started throwing this error again. At that time I just did a full re-install of IIS and my application started working again.

Once again this error has started to occur, I once again performed a full reinstall of IIS but this time that does not help and my applications continue to error due to this duplicate collection error.

I believe this all stems from an ISAPI issue I had long long ago prior to all of this which is detailed here. :

http://weblog.west-wind.com/posts/2011/Apr/04/Error-on-64-Bit-Install-of-IIS-LoadLibraryEx-failed-on-aspnetfilterdll

Really, I wondering if anyone else has seen this. Where I am really confused is if I look at the temp applicationHost.config file in the inetpub/temp/appPools location (this is the file that the application running is referencing and erroring on). The problem I have with this is that the current temp applicationHost.config that is being used by the application differs from the one found in the inteserv locations in that it has the ASP.NET_4.0.30319.0 line which is causing the error. The confusion is that this line causing the error has to be coming from some where but I cannot find it in the inetsrv locations or in the app pool locations, hence my confusion.

like image 326
Bill Blankenship Avatar asked Mar 31 '15 22:03

Bill Blankenship


1 Answers

I would assume that this must have been resolved for most, but in case if anyone still has this problem - I am having VS 2017 and i had this issue in the past on 2015. Later when i setup 2017, i see this nice little option that i believe resolved mine. And i hope it may even solve yours. Give a try.

And using IIS Express, refer to this screenshot of Web project properties showing the tiny little settings

In my case, being 64 bit OS, i had to set the x64 explicitly (on the bitness field). Having it as Default or x86 didnt had my mvc app run.

like image 86
Ak777 Avatar answered Oct 15 '22 19:10

Ak777