2
我想捆綁我的javascrip文件和css文件到我的MVC項目。添加它們時拋出異常。路徑中的非法字符。而捆綁JavaScript文件
Illegal characters in path.
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: Illegal characters in path.
Source Error:
Line 9: public static void RegisterBundles(BundleCollection bundles)
Line 10: {
Line 11: bundles.Add(new ScriptBundle("~/bundles/jquery").Include("~/Scripts/jquery-{version}.js",
Line 12: "~/js/bootstrap.js",
Line 13: "~/js/jquery.flexslider-min.js",
"~/js/jquery.isotope.js",
"~/js/jquery.fancybox.pack.js?v=2.1.0",
"~/rs-plugin/js/jquery.themepunch.plugins.min.js",
"~/rs-plugin/js/jquery.themepunch.revolution.min.js",
"~/js/revolution.custom.js",
"~/js/custom.js"
));
Stack Trace:
[ArgumentException: Illegal characters in path.]
System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional) +10631190
System.Security.Permissions.FileIOPermission.CheckIllegalCharacters(String[] str) +30
System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList) +97
System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String path) +63
System.Web.InternalSecurityPermissions.PathDiscovery(String path) +29
System.Web.HttpRequest.MapPath(VirtualPath virtualPath, VirtualPath baseVirtualDir, Boolean allowCrossAppMapping) +149
System.Web.HttpServerUtility.MapPath(String path) +104
System.Web.Optimization.BundleTable.<get_MapPathMethod>b__0(String virtualPath) +67
System.Web.Optimization.ItemRegistry.Include(String[] virtualPaths) +644
System.Web.Optimization.Bundle.Include(String[] virtualPaths) +64
IntensifyTech.IntensifyTechConfig.RegisterBundles(BundleCollection bundles) in c:\Users\sxxx\SkyDrive\Trunk\IntensifyTech\IntensifyTech\App_Start\IntensifyTechConfig.cs:11
IntensifyTech.MvcApplication.Application_Start() in c:\Users\sxxxx\SkyDrive\Trunk\IntensifyTech\IntensifyTech\Global.asax.cs:24
[HttpException (0x80004005): Illegal characters in path.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9859725
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118
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): Illegal characters in path.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9873912
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254
嘗試逐個註釋文件並查看文件導致問題的路徑。有時候,當你複製粘貼url時,它會發生。 – PSL 2013-03-26 18:16:13
我的猜測會是fancybox系列。您將包含一個查詢字符串 - 它是URL的一部分。這些軟件包只接受虛擬路徑,而不是URL。但請嘗試@PSCoder的建議來驗證。 – PatrickSteele 2013-03-26 18:20:54