IIS,LongPathsEnabled和260/248个字符限制

时间:2019-04-12 09:52:25

标签: iis windows-10

我们有一个Asp.net MVC网站,它的路径很长,除此之外,它的路径看起来像这样

\ Areas \ Workbench \ Views \ Workbench \ EditorTemplates \ MyCodePicker \ MyCodePickerCurrentSelection.cshtml

这超出了字符数限制

我已阅读到您应该能够在Windows 10框中设置LongPathsEnabled注册表值,重新启动后问题就会消失。但是,对我而言似乎并非如此?

我看到的其他解决方案是使用subst(似乎不起作用)和使用mklink / d(这似乎有效,但是到目前为止我做的测试非常有限)

(编辑,更多信息)

错误是 “指定的路径,文件名或两者均太长。完全限定的文件名必须少于260个字符,目录名称必须少于248个字符。”

此网站所在的路径确实很长

(我将下面的项目名称替换为

at System.IO.PathHelper.GetFullPathName()
at System.IO.Path.LegacyNormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.Path.GetFullPathInternal(String path)
at System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath)
at System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath)
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String path)
at System.Web.InternalSecurityPermissions.PathDiscovery(String path)
at System.Web.Hosting.HostingEnvironment.MapPath(VirtualPath virtualPath)
at RazorGenerator.Mvc.PrecompiledMvcEngine.IsPhysicalFileNewer(String virtualPath, String baseVirtualPath, Lazy`1 assemblyLastWriteTime)
at RazorGenerator.Mvc.PrecompiledMvcEngine.IsPhysicalFileNewer(String virtualPath)
at RazorGenerator.Mvc.PrecompiledMvcEngine.FileExists(ControllerContext controllerContext, String virtualPath)
at System.Web.Mvc.VirtualPathProviderViewEngine.<>c__DisplayClass7.<GetPathFromGeneralName>b__4(String path)
at System.Web.WebPages.DefaultDisplayMode.GetDisplayInfo(HttpContextBase httpContext, String virtualPath, Func`2 virtualPathExists)
at System.Web.Mvc.VirtualPathProviderViewEngine.GetPathFromGeneralName(ControllerContext controllerContext, List`1 locations, String name, String controllerName, String areaName, String cacheKey, String[]& searchedLocations)
at System.Web.Mvc.VirtualPathProviderViewEngine.GetPath(ControllerContext controllerContext, String[] locations, String[] areaLocations, String locationsPropertyName, String name, String controllerName, String cacheKeyPrefix, Boolean useCache, String[]& searchedLocations)
at System.Web.Mvc.VirtualPathProviderViewEngine.FindPartialView(ControllerContext controllerContext, String partialViewName, Boolean useCache)
at System.Web.Mvc.ViewEngineCollection.<>c__DisplayClass2.<FindPartialView>b__1(IViewEngine e)
at System.Web.Mvc.ViewEngineCollection.Find(Func`2 lookup, Boolean trackSearchedPaths)
at System.Web.Mvc.ViewEngineCollection.FindPartialView(ControllerContext controllerContext, String partialViewName)
at System.Web.Mvc.HtmlHelper.FindPartialView(ViewContext viewContext, String partialViewName, ViewEngineCollection viewEngineCollection)
at System.Web.Mvc.HtmlHelper.RenderPartialInternal(String partialViewName, ViewDataDictionary viewData, Object model, TextWriter writer, ViewEngineCollection viewEngineCollection)
at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)
at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName)
at ASP._Areas_<ProjName>_Views_HomeDesktop_IndexAdmin_cshtml.Execute() in C:\\DirName\\<ProjName>\\<ProjName>\\<ProjName>\\Areas\\<ProjName>\\Areas\\<ProjName>\\Views\\HomeDesktop\\IndexAdmin.cshtml:line 45
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
at RazorGenerator.Mvc.PrecompiledMvcView.Render(ViewContext viewContext, TextWriter writer)
at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)" string

0 个答案:

没有答案