Telerik MVC3 ScriptRegistrar结合异常

时间:2012-03-08 08:04:37

标签: asp.net-mvc-3 telerik

当我尝试将ScriptRegistrar(Telerik版本2011.3.1115)中的脚本与此代码组合时抛出异常:

@Html.Telerik().ScriptRegistrar().DefaultGroup(c => c.DefaultPath("~/Scripts/").Add("jquery.tools.min.js").Add("Common.js?v=1.1").Add("date.js").Add("jquery.validate.min.js").Add("jquery.validate.unobtrusive.min.js").Add("jquery.notty.js").Combined(true))

当我删除combine(.Combined(true))完美地工作(期望我没有组合脚本)。

例外是:

Server Error in '/' Application.
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:

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: Illegal characters in path.]
   System.Security.Permissions.FileIOPermission.HasIllegalCharacters(String[] str) +9360949
   System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList) +73
   System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String[] pathList, Boolean checkForDuplicates, Boolean needFullPath) +43
   System.IO.File.GetLastWriteTimeUtc(String path) +107
   System.Web.Compilation.TimeStampChecker.AddFileInternal(String virtualPath, String path) +33
   System.Web.Hosting.MapPathBasedVirtualFile.Open() +46
   System.Web.Hosting.VirtualPathProvider.OpenFile(String virtualPath) +31
   Telerik.Web.Mvc.Infrastructure.Implementation.VirtualPathProviderWrapper.ReadAllText(String virtualPath) +120
   Telerik.Web.Mvc.Infrastructure.Implementation.WebAssetGroupReader.Read(WebAssetGroup group) +286
   Telerik.Web.Mvc.WebAssetHttpHandler.ProcessRequest(HttpContextBase context) +340
   Telerik.Web.Mvc.Infrastructure.HttpHandlerBase.ProcessRequest(HttpContext context) +63
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +100
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

1 个答案:

答案 0 :(得分:3)

“Common.js?v = 1.1”不是有效的文件路径。 ScriptRegistrar需要一个有效的路径,因为它必须从文件系统中读取文件。