【问题标题】:Exception when handling multiple hostnames in Composite C1在 Composite C1 中处理多个主机名时出现异常
【发布时间】:2012-03-23 09:07:19
【问题描述】:

我在 Composite C1 中配置多个主机名时遇到问题。

背景:
我在 C1 中有两个网站:site1 和 site2。 C1 安装主要用于 site1,并与主机 www.site1.com(和别名 site1.com)一起使用。
现在,我已将另一个站点 site2 添加到 C1。浏览到 site1.com/site2 时,我最终进入了 site2 网站。一切都好。
然后我尝试将另一个主机名 www.site2.com 添加到 URL 配置 -> 主机名。添加 www.site2.com 并浏览到 www.site2.com 后,出现以下异常:“项目已添加。在字典中键入:''正在添加的键:''”

堆栈跟踪如下所示:

[ArgumentException:项目已被添加。字典中的键:''正在添加的键:''] System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add) +9353115 System.Collections.Hashtable.Add(对象键,对象值)+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 元素,IDictionary`2 urlToIdLookup,IPageUrlBuilder 构建器)+253 Composite.Core.WebClient.Renderings.Page.PageStructureInfo.BuildMap(UrlSpace urlSpace) +2200 Composite.Core.WebClient.Renderings.Page.PageStructureInfo.GetMap(PublicationScope 发布范围,CultureInfo 本地化范围,UrlSpace urlSpace) +482 Composite.Core.WebClient.Renderings.Page.PageStructureInfo.GetPageUrlBuilder(PublicationScope 发布范围,CultureInfo 本地化范围,UrlSpace urlSpace)+9 Composite.Plugins.Routing.Pages.DefaultPageUrlProvider.ParseUrl(字符串 relativeUrl,UrlSpace urlSpace,UrlKind& urlKind)+311 Composite.Plugins.Routing.Pages.DefaultPageUrlProvider.ParseUrl(字符串 absoluteUrl,UrlKind&urlKind)+306 Composite.Core.Routing.Pages .C1PageRoute.GetRouteData(HttpContextBase 上下文) +156 System.Web.Routing.RouteCollection.GetRouteData(HttpContextBase httpContext) +287 System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase 上下文) +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

有人对此有解决方案吗?

提前谢谢...

更新:
更改 Dmitry Dzygin 建议的 dll 后,我得到以下堆栈跟踪:

[ArgumentException:项目已被添加。字典中的键:''正在添加的键:''] System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add) +9353115 System.Collections.Hashtable.Add(对象键,对象值)+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) 在 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 元素, IDictionary`2 urlToIdLookup, IPageUrlBuilder builder) 在 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 根, IPageUrlBuilder pageUrlBuilder, IDictionary`2 urlToIdLookup) 在 c:\Builds\1\Freja\CodeplexBuild\Sources\Public\Composite\Core\ WebClient\Renderings\Page\PageStructureInfo.cs:612 Composite.Core.WebClient.Renderings.Page.PageStructureInfo.BuildMap(UrlSpace urlSpace) 在 c:\Builds\1\Freja\CodeplexBuild\Sources\Public\Composite\Core\WebClient\Renderings\Page\PageStructureInfo.cs:559 C:\Builds\1\Freja\CodeplexBuild\Sources\Public\Composite\Core\WebClient\Renderings\Page\PageStructureInfo 中的 Composite.Core.WebClient.Renderings.Page.PageStructureInfo.GetMap(PublicationScope 发布范围,CultureInfo 本地化范围,UrlSpace urlSpace) .cs:277 C:\Builds\1\Freja\CodeplexBuild\Sources\Public\Composite\Core\WebClient\Renderings\Page\PageStructureInfo 中的 Composite.Core.WebClient.Renderings.Page.PageStructureInfo.GetPageUrlBuilder(PublicationScope 发布范围,CultureInfo 本地化范围,UrlSpace urlSpace) .cs:342 Composite.Plugins.Routing.Pages.DefaultPageUrlProvider.ParseUrl(String relativeUrl, UrlSpace urlSpace, UrlKind& urlKind) 在 c:\Builds\1\Freja\CodeplexBuild\Sources\Public\Composite\Plugins\Routing\Pages\DefaultPageUrlProvider.cs:249 Composite.Plugins.Routing.Pages.DefaultPageUrlProvider.ParseUrl(String absoluteUrl, UrlKind& urlKind) 在 c:\Builds\1\Freja\CodeplexBuild\Sources\Public\Composite\Plugins\Routing\Pages\DefaultPageUrlProvider.cs:206 Composite.Core.Routing.Pages.C1PageRoute.GetRouteData(HttpContextBase context) 在 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 上下文) +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

【问题讨论】:

    标签: asp.net c1-cms


    【解决方案1】:

    当 2 个 C1 页面收到相同的 url 或类似的东西时,看起来像是某种 url 冲突。作为一种解决方案,我建议您将调试版本 Composite.dll 文件和 Composite.pdf 文件复制到您网站的 /bin 文件夹中。您可以在 Codeplex 的发布页面 (http://compositec1.codeplex.com/releases/view/80764) 的“其他可用下载部分”中找到这些内容,之后您将在代码中看到导致它的确切行。一旦你有了它,我就可以修复它或添加一些代码断言/验证逻辑。

    更新。

    查看代码似乎只有当您有 2 个网站的“UrlTitle”字段为空时才可能出现异常。通常有验证逻辑可以防止这种情况发生。尝试编辑两个网站的根目录,给它们一个不为空的“Url Title”字段,然后发布它们,这应该可以解决问题。如果错误仍然存​​在,我要么需要一个更好的重现(我无法使用提供的重现它),或者如果你给我发一份网站副本,我会调试它。

    【讨论】:

    • 感谢您的回复。更改 dll 后,我得到以下堆栈跟踪:
    • 它不见了,你能不能再发一次,或者编辑原来的问题
    • 或通过composite.net给我发送电子邮件ddz
    • 对不起。它在我完成之前提交了我的评论:(我已经编辑了问题以包含新的堆栈跟踪。我不允许发布那么多文本作为评论。
    • 嗨@Tech,我在 3 月 8 日更新了答案,您还没有收到通知。我做了一个修复,但我不知道哪个设置实际上重现了这个问题。请检查更新的答案
    猜你喜欢
    • 2012-01-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-24
    • 1970-01-01
    相关资源
    最近更新 更多