Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'svc-Int

Post here for help with installing or upgrading mojoPortal pre-compiled release packages. When posting in this forum, please provide all relevant details. You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

Post here for help with installation of mojoPortal pre-compiled release packages

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.

You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

This thread is closed to new posts. You must sign in to post in the forums.
12/29/2008 3:15:12 AM
Gravatar
Total Posts 88

Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'svc-Int

Hi Joe, hope you had a nice Christmas.

Since upgrade I haven't been able to run setup/default.aspx without an internal server error . I navigated to /Data/ but there is no currentlog.config file ?

However, my host has identified this web.config error:

Config Error: "Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'svc-Integrated'"

Config Source

831: <add name="svc-ISAPI-2.0" path="*.svc" verb="*" modules="IsapiModule" scriptProcessor="%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv2.0,bitness32" />

832: <add name="svc-Integrated" path="*.svc" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" resourceType="Unspecified" preCondition="integratedMode" />

833: <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

 

 

thks,

Leah

12/29/2008 3:37:32 AM
Gravatar
Total Posts 118

Re: Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'svc

Remove the following section from webconfig and try it - worked for me

 

Neil

<handlers>
<remove name="WebServiceHandlerFactory-Integrated" />
<remove name="ScriptHandlerFactory" />
<remove name="ScriptHandlerFactoryAppServices" />
<remove name="ScriptResource" />
<add name="svc-ISAPI-2.0" path="*.svc" verb="*" modules="IsapiModule" scriptProcessor="%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv2.0,bitness32" />
<add name="svc-Integrated" path="*.svc" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" resourceType="Unspecified" preCondition="integratedMode" />
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</handlers> 

12/29/2008 3:44:40 AM
Gravatar
Total Posts 88

Re: Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'svc

Thanks, that seems to have done the trick. Are there any implications for commenting out this section of the code?

 

12/29/2008 4:03:02 AM
Gravatar
Total Posts 118

Re: Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'svc

I havent found any yet - This is my first install and at the moment I am jusy playing but it appears ok 

12/29/2008 6:04:31 AM
Gravatar
Total Posts 18439

Re: Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'svc-Int

Hi Leah and Neil,

Apparently a pattern is emerging with this problem. I'm thinking I need to go ahead and comment out the problem parts there to avoid other people having this issue.

Since I can't reproduce this on my machine for some reason, it would help to know what is the minimum things that need to be commented out to fix it? Neil, could you try commenting out just these 2 lines and tell me if that is sufficient?

<add name="svc-ISAPI-2.0" path="*.svc" verb="*" modules="IsapiModule" scriptProcessor="%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv2.0,bitness32" />
<add name="svc-Integrated" path="*.svc" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" resourceType="Unspecified" preCondition="integratedMode" />

or does it really require taking out more to fix it?

This section is not essential now but is going to be important in the future for web services, so I'd like to be able to leave in the needed parts and just isolate the problems.

Best,

Joe

12/29/2008 6:24:03 AM
Gravatar
Total Posts 88

Re: Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'svc

Hi Joe,

I know you directed the question at Neil but as I'm sitting at my PC I gave this a quick go. If I only comment out the two parts you suggested I get a System.OutOfMemoryException error, with the following stack trace:


[OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.]
System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +43
System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +127
System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +142
System.Reflection.Assembly.Load(String assemblyString) +28
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46

[ConfigurationErrorsException: Exception of type 'System.OutOfMemoryException' was thrown.]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +613
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +203
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +105
System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +29
System.Web.Compilation.CompilationUtil.GetTypeFromAssemblies(AssemblyCollection assembliesCollection, String typeName, Boolean ignoreCase) +132
System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +291
System.Web.UI.Page.get_ScriptManagerType() +44
System.Web.UI.Page.get_IsPartialRenderingSupported() +61
System.Web.UI.WebControls.BaseValidator.RegisterValidatorCommonScript() +22
System.Web.UI.WebControls.BaseValidator.OnPreRender(EventArgs e) +53
System.Web.UI.Control.PreRenderRecursiveInternal() +80
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6741
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242
System.Web.UI.Page.ProcessRequest() +80
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.secure_login_aspx.ProcessRequest(HttpContext context) +4
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

[Exception: Unhandled Exception while processing NeatUpload child request]
Brettle.Web.NeatUpload.UploadHttpModule.Application_BeginRequest(Object sender, EventArgs e) +1149
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
 

12/29/2008 6:31:43 AM
Gravatar
Total Posts 18439

Re: Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'svc-Int

Hi Leah,

Thanks for the help! Ouch, that's quite a bad error, might need a reboot after that.

I guess I'll have to comment out the whole <handlers section until I can research it more and figure out whats going on there.

Best,

Joe

12/29/2008 6:34:13 AM
Gravatar
Total Posts 18439

Re: Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'svc-Int

Hi Leah,

Just for reference, are you seeing this error on Vista or a Win 2008 machine, or something else? What OS?

Best,

Joe

12/29/2008 6:39:26 AM
Gravatar
Total Posts 88

Re: Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'svc

Hi Joe, I am using Windows XP.

Yep I keep getting the same system.outofmemory exception now, despite having re-commented the <handlers> section. Going to try and reboot etc, hopefully that will cure it...

thks,

Leah

12/29/2008 6:53:24 AM
Gravatar
Total Posts 18439

Re: Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'svc-Int

Hi Leah,

Do you have .NET 3.5 SP1 installed?

Whats wierd is I don't get this error on my Vista dev machine nor on my production server running Win 2003 IIS6. Both environements are up to date with .NET 3.5 SP1.

Note that .NET 3.5 does not come down as a windows update and is not installed automatically, it has to be explicitly installed by downloading it from here then installing it.

I do not think it is installed automatically by default even on Win 2008 server.

Best,

Joe

12/29/2008 6:58:09 AM
Gravatar
Total Posts 118

Re: Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'svc-Int

 

Joe

Just tried removing

<add name="svc-ISAPI-2.0" path="*.svc" verb="*" modules="IsapiModule" scriptProcessor="%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv2.0,bitness32" />
<add name="svc-Integrated" path="*.svc" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" resourceType="Unspecified" preCondition="integratedMode" />

And it works fine on Win2008 - If you need somewhere to do testing on win2008 - let me know.

 

Regards

Neil

12/29/2008 7:06:15 AM
Gravatar
Total Posts 18439

Re: Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'svc-Int

Neil,

Thanks! Its good to know there are apparently differences based on OS. I've been meaning to setup a Win 2008 test machine here. I installed it on a machine I have here with drive cradles that make it easy to swap out different OSes, but the nic card I have in the machine doesn't have a driver for Win 2008, so I either need to get another nic card or set it up as a Virtual Machine. Guess I'll go ahead and order the nic card as I'd really rather have a physical machine to test on.

Best,

Joe

12/29/2008 7:17:42 AM
Gravatar
Total Posts 88

Re: Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'svc

Sorry Joe, in my haste I wasn't thinking clearly. the problem is on my remote installation with webhostforasp.net, not on my own PC. On my home PC it works fine, using Windows XP and yes with .NET 3.5 SP1 installed. My host  is supposed to be using 3.5 as well but I will double check the settings with them, will let you know.

thks

Leah

12/29/2008 7:25:22 AM
Gravatar
Total Posts 18439

Re: Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'svc-Int

Hi Leah,

Now I'm confused. I thought you were able to replicate the original problem on your local XP machine and commenting out the entire system.WebServer handlers section solved it there too, while commeting out only those 2 lines did not solve it but caused an out of memory error on your local machine. Is that correct or incorrect?

Best,

Joe

12/29/2008 7:38:20 AM
Gravatar
Total Posts 88

Re: Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'svc

Hi Joe,

I upgraded successfully on my local machine (using Windows XP, with .NET 3.5 SP1 installed). Have had no problems with 2.8.8.1 on my local machine.

I upgraded on the remote server and received the error message i refer to in my original post. I then commented out the <handlers> section in the web.config file on the remote server, which worked fine. Then I commented out only the 2 lines you asked for, again on the remote server. This then led to the memory exception.

So the handlers section is causing a problem on the remote server, but not on my local PC. I've gotten round it on the remot server for now by commenting out the whole section and re-started IIS which worked fine.

I do not know which exact version of Windows my host (webhostforasp.net) is using, but have raised a support ticket to find out. They are supposed to have .NET 3.5 and have asked them to check settings in my application pool.

Hope that makes things clearer.. let me know if not!

thks,

Leah

12/29/2008 8:35:54 AM
Gravatar
Total Posts 18439

Re: Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'svc-Int

Thanks Leah!

Now it is all clear to me.

Best,

Joe

12/30/2008 3:03:38 AM
Gravatar
Total Posts 88

Re: Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'svc

Hi Joe,

The remote server uses Windows 2008. .NET 3.5 SP1 hadn't been installed, they've now installed it for me, and now just commenting out those 2 lines works fine. So before they installed SP1, I got a memory exception with only 2 lines commented out, now I don't.

Hope that helps,

Leah

12/31/2008 7:29:21 AM
Gravatar
Total Posts 18439

Re: Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'svc-Int

Thanks Leah, it does help.

Happy New Year!

Cheers,

Joe

You must sign in to post in the forums. This thread is closed to new posts.