Mvc 4 FileNotFoundException MvcSiteMapProvider

时间:2014-10-12 22:08:23

标签: asp.net-mvc asp.net-mvc-4

我将程序集MvcSiteMapProvider添加到我的项目中,并决定不使用它。我删除了程序集,但我一直收到以下错误。我找不到对该文件的任何引用,我不确定这是如何失败的。

Exception Details: System.IO.FileNotFoundException: Could not find file 'C:\Users\jmynsb000\Documents\Visual Studio 2013\Projects\t2dashv6\t2dashv6\Mvc.sitemap'.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[FileNotFoundException: Could not find file 'C:\Users\jmynsb000\Documents\Visual Studio 2013\Projects\t2dashv6\t2dashv6\Mvc.sitemap'.]
   System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +10527478
   System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) +1305
   System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) +63
   System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy) +77
   System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn) +69
   System.Xml.XmlTextReaderImpl.FinishInitUriString() +75
   System.Xml.XmlTextReaderImpl..ctor(String uriStr, XmlReaderSettings settings, XmlParserContext context, XmlResolver uriResolver) +186
   System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext) +70
   System.Xml.XmlReader.Create(String inputUri, XmlReaderSettings settings, XmlParserContext inputContext) +26
   System.Xml.XmlReader.Create(String inputUri, XmlReaderSettings settings) +6
   MvcSiteMapProvider.Xml.SiteMapXmlValidator.ValidateXml(String xmlPath) +273
   MvcSiteMapProvider.DI.Composer.Compose() +224

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +192
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +108
   System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +19
   WebActivatorEx.BaseActivationMethodAttribute.InvokeMethod() +217
   WebActivatorEx.ActivationManager.RunActivationMethods(Boolean designerMode) +455
   WebActivatorEx.ActivationManager.RunPostStartMethods() +28
   WebActivatorEx.StartMethodCallingModule.Init(HttpApplication context) +101
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +418
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9950728
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

1 个答案:

答案 0 :(得分:6)

我怀疑当你运行项目时,MvcSiteMapProvider程序集仍然存在于bin文件夹中。 The MvcSiteMapProvider dynamically registers itself to run some start up code during the PostApplicationStart event

如果您是从Visual Studio运行它,请转到Build菜单,然后选择“Rebuild Solution”。如果您在服务器上运行它,请检查已部署的bin文件夹以查找MvcSiteMapProvider.dll程序集。如果它在那里,将其删除。