I have a problem configuring multiple hostnames in Composite C1.
Background:
I have two websites in C1: site1 and site2. The C1 installation is mainly for site1 and works with the host www.site1.com (and alias site1.com).
Now I've added another site, site2, to C1. When browsing to site1.com/site2 I end up on the site2 website. All fine.
Then I try to add another hostname, www.site2.com, to URL Configuration -> Hostnames. After adding www.site2.com and browsing to www.site2.com I get the following exception: "Item has already been added. Key in dictionary: '' Key being added: ''"
The stacktrace looks as follows:
[ArgumentException: Item has already been added. Key in dictionary: '' Key being added: ''] System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add) +9353115 System.Collections.Hashtable.Add(Object key, Object value) +11 Composite.Core.Collections.Generic.Hashtable`2.Add(TKey key, TValue value) +105 Composite.Plugins.Routing.Pages.PageUrlBuilder.BuildUrlSet(IPage page, Guid parentPageId) +1935 Composite.Core.WebClient.Renderings.Page.PageStructureInfo.BuildFolderPaths(SitemapBuildingData pagesData, IEnumerable`1 elements, IDictionary`2 urlToIdLookup, IPageUrlBuilder builder) +253 Composite.Core.WebClient.Renderings.Page.PageStructureInfo.BuildMap(UrlSpace urlSpace) +2200 Composite.Core.WebClient.Renderings.Page.PageStructureInfo.GetMap(PublicationScope publicationScope, CultureInfo localizationScope, UrlSpace urlSpace) +482 Composite.Core.WebClient.Renderings.Page.PageStructureInfo.GetPageUrlBuilder(PublicationScope publicationScope, CultureInfo localizationScope, UrlSpace urlSpace) +9 Composite.Plugins.Routing.Pages.DefaultPageUrlProvider.ParseUrl(String relativeUrl, UrlSpace urlSpace, UrlKind& urlKind) +311 Composite.Plugins.Routing.Pages.DefaultPageUrlProvider.ParseUrl(String absoluteUrl, UrlKind& urlKind) +306 Composite.Core.Routing.Pages.C1PageRoute.GetRouteData(HttpContextBase context) +156 System.Web.Routing.RouteCollection.GetRouteData(HttpContextBase httpContext) +287 System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context) +60 System.Web.Routing.UrlRoutingModule.OnApplicationPostResolveRequestCache(Object sender, EventArgs e) +86 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
Does anyone have a solution for this?
Thanks in advance...
UPDATE:
After changing the dll suggested by Dmitry Dzygin I get the following stack trace:
[ArgumentException: Item has already been added. Key in dictionary: '' Key being added: ''] System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add) +9353115 System.Collections.Hashtable.Add(Object key, Object value) +11 Composite.Core.Collections.Generic.Hashtable`2.Add(TKey key, TValue value) in c:\Builds\1\Freja\CodeplexBuild\Sources\Public\Composite\Core\Collections\Generic\Hashtable.cs:28 Composite.Plugins.Routing.Pages.PageUrlBuilder.BuildUrlSet(IPage page, Guid parentPageId) in c:\Builds\1\Freja\CodeplexBuild\Sources\Public\Composite\Plugins\Routing\Pages\PageUrlBuilder.cs:190 Composite.Core.WebClient.Renderings.Page.PageStructureInfo.BuildFolderPaths(SitemapBuildingData pagesData, IEnumerable`1 elements, IDictionary`2 urlToIdLookup, IPageUrlBuilder builder) in c:\Builds\1\Freja\CodeplexBuild\Sources\Public\Composite\Core\WebClient\Renderings\Page\PageStructureInfo.cs:630 Composite.Core.WebClient.Renderings.Page.PageStructureInfo.BuildFolderPaths(SitemapBuildingData pagesData, IEnumerable`1 roots, IPageUrlBuilder pageUrlBuilder, IDictionary`2 urlToIdLookup) in c:\Builds\1\Freja\CodeplexBuild\Sources\Public\Composite\Core\WebClient\Renderings\Page\PageStructureInfo.cs:612 Composite.Core.WebClient.Renderings.Page.PageStructureInfo.BuildMap(UrlSpace urlSpace) in c:\Builds\1\Freja\CodeplexBuild\Sources\Public\Composite\Core\WebClient\Renderings\Page\PageStructureInfo.cs:559 Composite.Core.WebClient.Renderings.Page.PageStructureInfo.GetMap(PublicationScope publicationScope, CultureInfo localizationScope, UrlSpace urlSpace) in c:\Builds\1\Freja\CodeplexBuild\Sources\Public\Composite\Core\WebClient\Renderings\Page\PageStructureInfo.cs:277 Composite.Core.WebClient.Renderings.Page.PageStructureInfo.GetPageUrlBuilder(PublicationScope publicationScope, CultureInfo localizationScope, UrlSpace urlSpace) in c:\Builds\1\Freja\CodeplexBuild\Sources\Public\Composite\Core\WebClient\Renderings\Page\PageStructureInfo.cs:342 Composite.Plugins.Routing.Pages.DefaultPageUrlProvider.ParseUrl(String relativeUrl, UrlSpace urlSpace, UrlKind& urlKind) in c:\Builds\1\Freja\CodeplexBuild\Sources\Public\Composite\Plugins\Routing\Pages\DefaultPageUrlProvider.cs:249 Composite.Plugins.Routing.Pages.DefaultPageUrlProvider.ParseUrl(String absoluteUrl, UrlKind& urlKind) in c:\Builds\1\Freja\CodeplexBuild\Sources\Public\Composite\Plugins\Routing\Pages\DefaultPageUrlProvider.cs:206 Composite.Core.Routing.Pages.C1PageRoute.GetRouteData(HttpContextBase context) in c:\Builds\1\Freja\CodeplexBuild\Sources\Public\Composite\Core\Routing\Pages\C1PageRoute.cs:90 System.Web.Routing.RouteCollection.GetRouteData(HttpContextBase httpContext) +287 System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context) +60 System.Web.Routing.UrlRoutingModule.OnApplicationPostResolveRequestCache(Object sender, EventArgs e) +86 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
Looks like some of kind of a url collision when 2 C1 pages received the same url or something like that. As a solution I recommend you to copy debug version Composite.dll file and Composite.pdf files to the /bin folder of your website. You can find those at Codeplex in "Other available downloads section" of the release page ( http://compositec1.codeplex.com/releases/view/80764 ) After that you will see the exact line in the code that caused it. Once you have it, I'll be able to either fix it or to add some code assertions/validation logic.
Update.
Looking through code it appears that the exception is possible only if you have 2 websites with empty "UrlTitle" field. Normally there's validation logic that prevents this situation from happenning. Try to edit both website's roots, give them not empty "Url Title" fields, and publish them afterwards, that should solve the issue. If the bug is still persists, I either need a better repro (I failed to reproduce it with the provided one), or if you send me a copy of a website, I'll debug it.