1

だから私はMVCWebアプリを持っています、それは現在MVC 3、C#にあります。

私はMVCサイトマップを使用しましたが、時々このエラーが発生します。

System.InvalidOperationException: Multiple nodes with the same URL '/Home.mvc.aspx/Index' were found. XmlSiteMapProvider requires that sitemap nodes have unique URLs.
Generated: Fri, 18 May 2012 14:46:20 GMT

System.InvalidOperationException: An error occurred when trying to create a controller of type 'StudentPortal3G.Controllers.HomeController'. Make sure that the controller has a parameterless public constructor. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> MvcSiteMap.Core.MvcSiteMapException: An error occured while parsing the SiteMap XML. Check the inner exception for more details. ---> System.InvalidOperationException: Multiple nodes with the same URL '/Home.mvc.aspx/Index' were found. XmlSiteMapProvider requires that sitemap nodes have unique URLs.
   at System.Web.StaticSiteMapProvider.AddNode(SiteMapNode node, SiteMapNode parentNode)
   at MvcSiteMap.Core.MvcSiteMapProvider.AddNode(SiteMapNode node, SiteMapNode parentNode) in D:\Project Files\JCDCHelper\WebApp\MvcSiteMap.Core\MvcSiteMapProvider.cs:line 356
   at MvcSiteMap.Core.MvcSiteMapProvider.AddNode(SiteMapNode node) in D:\Project Files\JCDCHelper\WebApp\MvcSiteMap.Core\MvcSiteMapProvider.cs:line 336
   at MvcSiteMap.Core.MvcSiteMapProvider.BuildSiteMap() in D:\Project Files\JCDCHelper\WebApp\MvcSiteMap.Core\MvcSiteMapProvider.cs:line 264
   --- End of inner exception stack trace ---
   at MvcSiteMap.Core.MvcSiteMapProvider.BuildSiteMap() in D:\Project Files\JCDCHelper\WebApp\MvcSiteMap.Core\MvcSiteMapProvider.cs:line 309
   at MvcSiteMap.Core.MvcSiteMapProvider.GetRootNodeCore() in D:\Project Files\JCDCHelper\WebApp\MvcSiteMap.Core\MvcSiteMapProvider.cs:line 365
   at System.Web.SiteMapProvider.get_RootNode()
   at MvcSiteMap.Core.MvcSiteMapProvider.get_RootNode() in D:\Project Files\JCDCHelper\WebApp\MvcSiteMap.Core\MvcSiteMapProvider.cs:line 120
   at System.Web.SiteMap.get_RootNode()
   at StudentPortal3G.Controllers.BaseController.LoadHeaderInfo() in d:\CC\StudentPortal3G\Source\StudentPortal3G\Controllers\BaseController.cs:line 40
   at JCDCHelper.MVCController.JCDCBaseController..ctor(INetLog passNetLog, IUserMaintBLL passUserMaintBLL) in d:\CC\JCDCHelper.MVCController\Source\JCDCHelper.MVCController\JCDCBaseController.cs:line 47
   at JCDCHelper.MVCController.JCDCBaseController..ctor() in d:\CC\JCDCHelper.MVCController\Source\JCDCHelper.MVCController\JCDCBaseController.cs:line 33
   at StudentPortal3G.Controllers.HomeController..ctor() in d:\CC\StudentPortal3G\Source\StudentPortal3G\Controllers\HomeController.cs:line 35
   --- End of inner exception stack trace ---
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Web.Mvc.DefaultControllerFactory.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType)
   --- End of inner exception stack trace ---
   at System.Web.Mvc.DefaultControllerFactory.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType)
   at System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName)
   at System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory)
   at System.Web.Mvc.MvcHandler.<>c__DisplayClass6.<BeginProcessRequest>b__2()
   at System.Web.Mvc.SecurityUtil.<>c__DisplayClassb`1.<ProcessInApplicationTrust>b__a()
   at System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust[TResult](Func`1 func)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

しかし、これらのノードが2つではなく、その場合は毎回エラーが発生することを私は知っています。

誰かがこれを以前に経験したことがありますか?

4

1 に答える 1

1

プロジェクトで MvcSiteMapProvider を使用していますが、気に入りません。私が抱えている問題の 1 つは、スレッドセーフではないことです (または、少なくともそれが私の結論です)。複数のページで同時に最初の読み込みを行うと、同様のエラーが発生します。ソースに貢献する以外に、それを回避する方法はわかりません。私の推測では、/home は xml の最初のノードであり、再度実行を開始したときに既に読み込まれていると思います。

于 2012-05-18T15:35:04.790 に答える