디렉토리가 존재하지 않습니다. 매개 변수 이름 : directoryVirtualPath
방금 Arvixe의 호스트에게 프로젝트를 게시 하고이 오류가 발생했습니다 (로컬에서 잘 작동 함).
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
무슨 뜻인가요 ?
나는 같은 문제가 있었고 {version} 및 *와 같은 와일드 카드를 사용하여 존재하지 않는 파일을 가리키는 번들이 있음을 발견했습니다.
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
나는 그것들을 모두 제거하고 오류가 사라졌습니다.
나는이 같은 문제가 있었고 코드 문제가 아니었다. FTP 옵션이 아닌 게시 옵션을 사용하고 있었으며 Visual Studio가 "내 프로젝트에 포함되지 않았기 때문에"스크립트 / css를 Azure 서버에 업로드하지 않았습니다. 따라서 로컬 하드 드라이브에 파일이 있기 때문에 로컬에서 제대로 작동했습니다. 필자의 경우이 문제를 해결 한 것은 "프로젝트> 모든 파일 표시 ..."였으며 포함되지 않은 파일을 마우스 오른쪽 버튼으로 클릭하고 포함하고 다시 게시하십시오.
여기에 이것을 쉽게하기 위해 쓴 간단한 수업이 있습니다.
using System.Web.Hosting;
using System.Web.Optimization;
// a more fault-tolerant bundle that doesn't blow up if the file isn't there
public class BundleRelaxed : Bundle
{
public BundleRelaxed(string virtualPath)
: base(virtualPath)
{
}
public new BundleRelaxed IncludeDirectory(string directoryVirtualPath, string searchPattern, bool searchSubdirectories)
{
var truePath = HostingEnvironment.MapPath(directoryVirtualPath);
if (truePath == null) return this;
var dir = new System.IO.DirectoryInfo(truePath);
if (!dir.Exists || dir.GetFiles(searchPattern).Length < 1) return this;
base.IncludeDirectory(directoryVirtualPath, searchPattern);
return this;
}
public new BundleRelaxed IncludeDirectory(string directoryVirtualPath, string searchPattern)
{
return IncludeDirectory(directoryVirtualPath, searchPattern, false);
}
}
사용하려면 코드에서 ScriptBundle을 BundleRelaxed로 바꾸십시오.
bundles.Add(new BundleRelaxed("~/bundles/admin")
.IncludeDirectory("~/Content/Admin", "*.js")
.IncludeDirectory("~/Content/Admin/controllers", "*.js")
.IncludeDirectory("~/Content/Admin/directives", "*.js")
.IncludeDirectory("~/Content/Admin/services", "*.js")
);
나는 오늘 같은 문제에 부딪쳤다. 실제로 ~ / 스크립트 아래의 일부 파일이 게시되지 않았다는 것을 알았다. 누락 된 파일을 게시 한 후에 문제가 해결되었습니다.
또한 bundles.config 파일에 존재하지 않는 디렉토리를 두어이 오류가 발생했습니다. 이것을 변경 :
<?xml version="1.0"?>
<bundleConfig ignoreIfDebug="true" ignoreIfLocal="true">
<cssBundles>
<add bundlePath="~/css/shared">
<directories>
<add directoryPath="~/content/" searchPattern="*.css"></add>
</directories>
</add>
</cssBundles>
<jsBundles>
<add bundlePath="~/js/shared">
<directories>
<add directoryPath="~/scripts/" searchPattern="*.js"></add>
</directories>
<!--
<files>
<add filePath="~/scripts/jscript1.js"></add>
<add filePath="~/scripts/jscript2.js"></add>
</files>
-->
</add>
</jsBundles>
</bundleConfig>
이에:
<?xml version="1.0"?>
<bundleConfig ignoreIfDebug="true" ignoreIfLocal="true">
<cssBundles>
</cssBundles>
<jsBundles>
</jsBundles>
</bundleConfig>
나를 위해 문제를 해결하십시오.
@JerSchneid와 마찬가지로 내 문제는 빈 디렉토리 였지만 배포 프로세스는 OP와 다릅니다. Kudu를 사용하는 Azure에서 git 기반 배포를 수행했으며 git이 저장소에 빈 디렉토리를 포함하지 않는다는 것을 알지 못했습니다. 참조 https://stackoverflow.com/a/115992/1876622를
내 로컬 폴더 구조는 다음과 같습니다.
[프로젝트 루트] / Content / jquery-plugins // 파일이있었습니다
[Project Root]/Scripts/jquery-plugins // had files
[Project Root]/Scripts/misc-plugins // empty folder
Whereas any clone / pull of my repository on the remote server was not getting said empty directory:
[Project Root]/Content/jquery-plugins // had files
[Project Root]/Scripts/jquery-plugins // had files
The best approach to fixing this is to create a .keep file in the empty directory. See this SO solution: https://stackoverflow.com/a/21422128/1876622
I had the same issue. the problem in my case was that the script's folder with all the bootstrap/jqueries scripts was not in the wwwroot folder. once I added the script's folder to wwwroot the error went away.
This can also be caused by a race condition while deploying:
If you use Visual Studio's "Publish" to deploy over a network file share, and check "Delete all existing files prior to publish." (I do this sometimes to ensure that we're not unknowingly still depending on files that have been removed from the project but are still hanging out on the server.)
If someone hits the site before all the required JS/CSS files are re-deployed, it will start Application_Start
and RegisterBundles
which will fail to properly construct the bundles and throw this exception.
But by the time you get this exception and go check the server, all the necessary files are right where they should be!
However, the application happily continues to serve the site, generating 404's for any bundle request, along with the unstyled/unfunctional pages that result from this, and never tries to rebuild the bundles even after the necessary JS/CSS files are now available.
A re-deploy using "Replace matching files with local copies" will trigger the app to restart and properly register the bundles this time.
This may be an old issue.I have similar error and in my case it was Scripts folder hiding in my Models Folder. Stack trace clearly says its missing Directory and by default all Java Scripts should be in Scripts Folder. This may not be applicable to above users.
I had created a new Angular
application and written
bundles.Add(new ScriptBundle("~/bundles/app")
.IncludeDirectory("~/Angular", "*.js")
.IncludeDirectory("~/Angular/directives/shared", "*.js")
.IncludeDirectory("~/Angular/directives/main", "*.js")
.IncludeDirectory("~/Angular/services", "*.js"));
but I had created no services
, so the services
folder was not deployed on publish as it was empty. Unfortunately, you have to put a dummy file inside any empty folder in order for it to publish
I too faced the same issue. Browsed to the file path under Script Folder.Copied the exact file name and made change in bundle.cs:
Old Code : //Bundle.cs
public class BundleConfig
{
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
}
}
New Code :
public class BundleConfig
{
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-1.10.2.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate.js"));
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-2.6.2.js"));
}
}
I had this issue when I opened a VS2017 project in VS2015, built the solution and then uploaded the DLLs.
Rebuilding it in VS2017 and re-uploading the DLLs fixed the issue.
I got the same question! It seems to with IIS Express. I change the IIS Express' URL for Project Like:
"http://localhost:3555/"
then the problem gone.
My problem was that my site had no files to bundle. However, I had created the site with an MVC template, which includes jQuery scripts. The bundle.config referred to those files and their folders. Not needing the scripts, I deleted them. After editing the bundle.config, all was good.
All was working fine, then while making unrelated changes and on next build came across the same issue. Used source control to compare to previous versions and discovered that my ../Content/Scripts folder had mysteriously been emptied!
Restored ../Content/Scripts/*.*from a backup and all worked well!
ps: Using VS2012, MVC4, had recently updated some NuGet packages, so that might have played some part in the issue, but all ran well for a while after the update, so not sure.
look into your BundleConfig.cs file for the lines that invokes IncludeDirectory()
ie:
bundles.Add(new Bundle("~/bundle_js_angularGrid").IncludeDirectory(
"~/Scripts/Grid", "*.js", true));
my Grid directory did not exist.
I also had this error when I combined all my separated bundles into one bundle.
bundles.Add(new ScriptBundle("~/bundles/one").Include(
"~/Scripts/one.js"));
bundles.Add(new ScriptBundle("~/bundles/two").Include(
"~/Scripts/two.js"));
Changed to
bundles.Add(new ScriptBundle("~/bundles/js").Include(
"~/Scripts/one.js",
"~/Scripts/two.js"));
I had to refresh application pool on my shared hosting's control panel to fix this issue.
Removing this lines of code from the bundleConfig.cs class file resolved my challenge:
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
None of these answers helped me since I created my jsx
files in a weird way. My code was working in localhost mode but failed in production.
The fix for me was to go into the csproj
file and change the file paths from <None ...
to <Content ...
Files that are running your application are missing. Try building and re-uploading your project. Or if you have a backup, try returning from backup. Will solve the problem
Basically stack trace gives you the exact place (as highlighted in screenshot) you need to remove non-existing resource.
There is path problem for script folder,find it and place it to its main path (~\Project_Name\Scripts)
'IT story' 카테고리의 다른 글
'IList'vs 'ICollection'vs 'Collection'반환 (0) | 2020.08.05 |
---|---|
jQuery에서 라디오 버튼의 이름이 모두 같을 때 어떻게 라디오 버튼의 값을 얻습니까? (0) | 2020.08.05 |
EC2의 CPU 크레딧 잔고 란 무엇입니까? (0) | 2020.08.05 |
PostgreSQL : 통화에 어떤 데이터 유형을 사용해야합니까? (0) | 2020.08.05 |
이 포인터 사용을 예측할 수 없게 만드는 것은 무엇입니까? (0) | 2020.08.05 |