2012-07-04 10 views
9

Używam programu Visual Studio Express 2012 RC.Katalog nie istnieje - Nazwa parametru: katalogVirtualPath

  • Jeśli utworzyć pusty "Hello World MVC 4.5 projekt"
  • I Downgrade go do 4,0 tak jest to zgodne z moim hosta (Arvixe)
  • opublikować go na gospodarza.

A następnie pojawia się ten komunikat o błędzie, mogę znaleźć wszelkie informacje na ten temat w Internecie.

Server Error in '/' Application. 

Directory does not exist. 
Parameter name: directoryVirtualPath 

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentException: Directory does not exist. 
Parameter name: directoryVirtualPath 

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: 


[ArgumentException: Directory does not exist. 
Parameter name: directoryVirtualPath] 
    System.Web.Optimization.Bundle.IncludeDirectory(String directoryVirtualPath, String searchPattern, Boolean searchSubdirectories) +357 
    System.Web.Optimization.Bundle.Include(String[] virtualPaths) +287 
    IconBench.BundleConfig.RegisterBundles(BundleCollection bundles) +75 
    IconBench.MvcApplication.Application_Start() +128 

[HttpException (0x80004005): Directory does not exist. 
Parameter name: directoryVirtualPath] 
    System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9160125 
    System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +131 
    System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +194 
    System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +339 
    System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +253 

[HttpException (0x80004005): Directory does not exist. 
Parameter name: directoryVirtualPath] 
    System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9079228 
    System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97 
    System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +256 

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.237 

Co to znaczy?

Kod na żądanie ^^

public class HomeController : Controller 
{ 
    public ActionResult Index() 
    { 
     return Content("Hello world"); 
    } 
} 

to jedyny kod dodałem.

kod Application_Start

public class MvcApplication : System.Web.HttpApplication 
{ 
    protected void Application_Start() 
    { 
     AreaRegistration.RegisterAllAreas(); 

     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); 
     RouteConfig.RegisterRoutes(RouteTable.Routes); 
     BundleConfig.RegisterBundles(BundleTable.Bundles); 
    } 
} 

RouteConfig

public class RouteConfig 
{ 
    public static void RegisterRoutes(RouteCollection routes) 
    { 
     routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 

     routes.MapHttpRoute(
      name: "DefaultApi", 
      routeTemplate: "api/{controller}/{id}", 
      defaults: new { id = RouteParameter.Optional } 
     ); 

     routes.MapRoute(
      name: "Default", 
      url: "{controller}/{action}/{id}", 
      defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 
     ); 
    } 
} 

FilterConfig

public class FilterConfig 
{ 
    public static void RegisterGlobalFilters(GlobalFilterCollection filters) 
    { 
     filters.Add(new HandleErrorAttribute()); 
    } 
} 

BundleConfig

public class BundleConfig 
{ 
    public static void RegisterBundles(BundleCollection bundles) 
    { 
     bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
        "~/Scripts/jquery-1.*")); 

     bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
        "~/Scripts/jquery-ui*")); 

     bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
        "~/Scripts/jquery.unobtrusive*", 
        "~/Scripts/jquery.validate*")); 

     bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
        "~/Scripts/modernizr-*")); 

     bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css")); 

     bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
        "~/Content/themes/base/jquery.ui.core.css", 
        "~/Content/themes/base/jquery.ui.resizable.css", 
        "~/Content/themes/base/jquery.ui.selectable.css", 
        "~/Content/themes/base/jquery.ui.accordion.css", 
        "~/Content/themes/base/jquery.ui.autocomplete.css", 
        "~/Content/themes/base/jquery.ui.button.css", 
        "~/Content/themes/base/jquery.ui.dialog.css", 
        "~/Content/themes/base/jquery.ui.slider.css", 
        "~/Content/themes/base/jquery.ui.tabs.css", 
        "~/Content/themes/base/jquery.ui.datepicker.css", 
        "~/Content/themes/base/jquery.ui.progressbar.css", 
        "~/Content/themes/base/jquery.ui.theme.css")); 
    } 
} 
+0

można pisać kod –

+0

Pewnie tak, ale to tylko test. – BjarkeCK

+1

Czy możesz opublikować kod wewnątrz application_start? –

Odpowiedz

15

wydaje się, że błąd ten wywodzi się z „nie w tym pożądanych plików w katalogu danej aplikacji” lub przesłać kod w katalogu, który nie jest skonfigurowany jako katalog wirtualny, lub nawet w niewłaściwej katalogu.

+0

Myślę, że masz rację :) Przetestuję to i wrócę w min. – BjarkeCK

+0

ok, daj mi znać twój wynik. powodzenia. –

+0

Cóż, myślę, że to rozwiązało problem, ale teraz jest nowy: http: ** temp.iconbench.com/ – BjarkeCK

5

Ten post jest podobna do Directory does not exist. Parameter name: directoryVirtualPath

Odpowiedź pomógł mi debug. Najwyraźniej brakuje brakujących folderów na serwerze docelowym. Moja aplikacja działała dobrze lokalnie, ale kiedy opublikowałem, kilka podkatalogów nie zostało opublikowanych. Kiedy ręcznie FTP'd je, aplikacja działała dobrze!

+0

To też był mój problem. Visual Studio nie wydaje się domyślnie Opróżniać katalogów, nawet jeśli aplikacja używa ich i są one Zawarte w Projekcie. –

3

Aby rozwinąć informacje tutaj.

Często pakuję wszystkie pliki w foldery takie jak: "~/Content/js/angular/modules/*.js", Działa to znakomicie, dopóki folder istnieje.

Problem polega na tym, że jeśli ten folder jest pusty po opublikowaniu, nie zostanie opublikowany i spowoduje powyższy wyjątek. Więc teraz wstawiam pusty.txt lub coś w rodzaju ręcznego dodawania folderu, jeśli chcę, aby na razie pozostały puste.

+0

Ah, to zaoszczędziło mi godziny :) Dzięki – Yulian

-4

Tworzenie katalogu "/ content/themes/base"

0

sprawdź czy masz dll w folderze bin, a także dll istnieje w remove dll GAC

z GAC

Powiązane problemy