2012-07-04 18 views
9

Utilizzo Visual Studio Express 2012 RC.La directory non esiste - Nome parametro: directoryVirtualPath

  • Se un creare un vuoto "ciao mondo MVC 4.5 progetto"
  • I downgrade a 4.0, in modo che sia compatibile con il mio ospite (Arvixe)
  • lo pubblico per l'host.

E poi ottengo questo messaggio di errore, posso trovare qualsiasi informazione su di esso online.

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 

Che cosa significa?

codice come richiesto ^^

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

questo è l'unico codice ho aggiunto.

codice 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

potete inserire il vostro codice –

+0

Certo lo farà, ma è solo un test. – BjarkeCK

+1

puoi pubblicare il codice all'interno di application_start? –

risposta

15

sembra che questo errore deriva da "esclusi i file desiderati nella directory dell'applicazione" o caricando il codice in una directory che non è configurata come directory virtuale, o anche nella directory corretta.

+0

Penso che tu abbia ragione :) Testeremo e tornerò in un min – BjarkeCK

+0

ok fammi sapere il tuo risultato. in bocca al lupo. –

+0

Beh, penso che abbia risolto il problema, ma ora è nuovo: http: ** temp.iconbench.com/ – BjarkeCK

5

Questo post è simile a Directory does not exist. Parameter name: directoryVirtualPath

La risposta mi ha aiutato di debug. Apparentemente, ci sono cartelle mancanti sul server di destinazione. La mia applicazione ha funzionato bene a livello locale, ma quando ho pubblicato, diverse sottodirectory script non sono state pubblicate. Quando li ho trasferiti manualmente su FTP, l'app ha funzionato bene!

+0

Anche questo era il mio problema. Visual Studio non sembra pubblicare le directory vuote per impostazione predefinita, anche se l'applicazione le utilizza e sono incluse nel progetto. –

3

Per espandere le informazioni qui.

Spesso raggruppo tutti i file in una cartella in questo modo: "~/Content/js/angular/modules/*.js", E funziona perfettamente finché esiste la cartella.

Il problema è, se quella cartella è vuota quando si pubblica non verrà pubblicata e comporterà l'eccezione di cui sopra. Così ora ho messo un empty.txt o qualcosa del tipo di aggiungere la cartella manualmente se voglio che rimangano vuoti per ora.

+0

Ah, mi ha risparmiato ore :) Grazie – Yulian

-4

Crea directory "/ content/themes/base"

0

di controllo se si dispone di dll nella cartella bin e anche la dll esistere nel GAC

rimuovere DLL dal GAC

Problemi correlati