jmyns
jmyns

Reputation: 127

Mvc 4 FileNotFoundException MvcSiteMapProvider

I added the assembly MvcSiteMapProvider to my project and decided not to use it. I removed the assembly but I keep getting the following error. I can't find any reference to the file and I'm not sure how this is failing.

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

Upvotes: 3

Views: 1940

Answers (1)

Steven V
Steven V

Reputation: 16585

I suspect that the MvcSiteMapProvider assembly is still living in your bin folder when you're running the project. The MvcSiteMapProvider dynamically registers itself to run some start up code during the PostApplicationStart event.

If you're running it from Visual Studio, go to the Build menu, then select "Rebuild Solution". If you're running it on a server, check the deployed bin folder for the MvcSiteMapProvider.dll assembly. If it is there, remove it.

Upvotes: 7

Related Questions