Html Net核心3.0中的路径';价值';必须以'/';

Html Net核心3.0中的路径';价值';必须以'/';,html,css,asp.net-mvc,asp.net-core,Html,Css,Asp.net Mvc,Asp.net Core,我找不到此问题的调用堆栈,看起来控制器一切正常,但“asp href include”有问题 例外情况如下: ArgumentException: The path in 'value' must start with '/'. (Parameter 'value') Microsoft.AspNetCore.Http.PathString..ctor(string value) Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAsse

我找不到此问题的调用堆栈,看起来控制器一切正常,但“asp href include”有问题

例外情况如下:

ArgumentException: The path in 'value' must start with '/'. (Parameter 'value')
Microsoft.AspNetCore.Http.PathString..ctor(string value)
Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAssetsFileProvider.StartsWithBasePath(string subpath, out PathString rest)
Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAssetsFileProvider.GetDirectoryContents(string subpath)
Microsoft.Extensions.FileProviders.Composite.CompositeDirectoryContents.EnsureDirectoriesAreInitialized()
Microsoft.Extensions.FileProviders.Composite.CompositeDirectoryContents.EnsureFilesAreInitialized()
Microsoft.Extensions.FileProviders.Composite.CompositeDirectoryContents.GetEnumerator()
Microsoft.AspNetCore.Mvc.TagHelpers.FileProviderGlobbingDirectory.EnumerateFileSystemInfos()+MoveNext()
System.Collections.Generic.List<T>.InsertRange(int index, IEnumerable<T> collection)
System.Collections.Generic.List<T>.AddRange(IEnumerable<T> collection)
Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase directory, string parentRelativePath)
Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase directory, string parentRelativePath)
Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Execute()
Microsoft.Extensions.FileSystemGlobbing.Matcher.Execute(DirectoryInfoBase directoryInfo)
Microsoft.AspNetCore.Mvc.TagHelpers.GlobbingUrlBuilder.FindFiles(Matcher matcher)
Microsoft.AspNetCore.Mvc.TagHelpers.GlobbingUrlBuilder.ExpandGlobbedUrl(string include, string exclude)
Microsoft.AspNetCore.Mvc.TagHelpers.GlobbingUrlBuilder.BuildUrlList(string staticUrl, string includePattern, string excludePattern)
Microsoft.AspNetCore.Mvc.TagHelpers.LinkTagHelper.BuildGlobbedLinkTags(TagHelperAttributeList attributes, TagHelperContent builder)
Microsoft.AspNetCore.Mvc.TagHelpers.LinkTagHelper.Process(TagHelperContext context, TagHelperOutput output)
Microsoft.AspNetCore.Razor.TagHelpers.TagHelper.ProcessAsync(TagHelperContext context, TagHelperOutput output)
Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner.RunAsync(TagHelperExecutionContext executionContext)
AspNetCore.Views_Shared__Layout.<ExecuteAsync>b__17_0() in _Layout.cshtml
-
    <meta charset="utf-8" />
    <title>bizz - @ViewData["Title"]</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta content="width=device-width, initial-scale=1" name="viewport" />
    <meta content="" name="description" />
    <meta content="" name="author" />
    <link asp-href-include="~/bundle/metronic-mandatory.min.css" rel="stylesheet" asp-append-version="true" /> <-- this line is highlighted red
    <link asp-href-include="~/bizz/style/common.min.css" rel="stylesheet" asp-append-version="true" />
    @RenderSection("style", false)
    <script asp-src-include="~/bundle/metronic-mandatory.min.js" asp-append-version="true"></script>
    <script asp-src-include="~/bundle/common.min.js" asp-append-version="true"></script>
    <script asp-src-include="~/bundle/jquery-validation.min.js" asp-append-version="true"></script>
Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.SetOutputContentAsync()
AspNetCore.Views_Shared__Layout.ExecuteAsync()
Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, bool invokeViewStarts)
Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderLayoutAsync(ViewContext context, ViewBufferTextWriter bodyWriter)
Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, string contentType, Nullable<int> statusCode)
Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ActionContext actionContext, IView view, ViewDataDictionary viewData, ITempDataDictionary tempData, string contentType, Nullable<int> statusCode)
Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor.ExecuteAsync(ActionContext context, ViewResult result)
Microsoft.AspNetCore.Mvc.ViewResult.ExecuteResultAsync(ActionContext context)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|29_0<TFilter, TFilterAsync>(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext<TFilter, TFilterAsync>(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
编辑: 也许我忘了提到这个html在_Layout.cshtml中。这和问题有关吗?而且,无论我写什么,它都会恢复到原来的样子

EDIT2:我已经根据其中一条评论编辑了我的代码。 错误仍然是一样的。

您需要使用
@URL.content
解析内容URL,例如:

<script asp-src-include="@Url.Content("~/bundle/metronic-mandatory.min.js")" asp-append-version="true"></script>

您需要使用
@URL.content
解析内容URL,例如:

<script asp-src-include="@Url.Content("~/bundle/metronic-mandatory.min.js")" asp-append-version="true"></script>

我遇到了同样的问题,我认为这是.NET Core 3的问题。在这里检查github问题- 在3.0中,当在脚本部分内使用asp src include标记帮助程序来包含javascript文件时,会生成500错误。这个标记辅助程序在2.2中工作得很好


我遇到了同样的问题,我认为这是.NET Core 3的问题。在这里检查github问题- 在3.0中,当在脚本部分内使用asp src include标记帮助程序来包含javascript文件时,会生成500错误。这个标记辅助程序在2.2中工作得很好


好的,我试过你的评论,我编辑了第一行的代码以检查它是否有效。但很明显它就消失了?这真的很难解释,所以我只是为它制作了一个视频。抱歉,手机视频:@JeremyGyovai Rafa你有没有尝试过清理和重建。即使资源不存在,
~
问题也应根据您的评论进行编辑。即使编辑了代码,问题仍然是一样的。好吧,我已经尝试了你的评论,我编辑了第一行的代码以检查它是否有效。但很明显它就消失了?这真的很难解释,所以我只是为它制作了一个视频。抱歉,手机视频:@JeremyGyovai Rafa你有没有尝试过清理和重建。即使资源不存在,
~
问题也应根据您的评论进行编辑。即使编辑了代码,问题仍然是一样的。谢谢你的提醒。你知道什么时候可以修复吗?GitHub发布的线程说Preview 3,它将在12月的第一周左右有一个代码锁定的时间框架,所以我认为至少要到2019年12月中旬才能修复。这是里程碑-谢谢你的提醒。你知道什么时候可以修复吗?GitHub发布的线程说Preview 3,它将在12月的第一周左右有一个代码锁定的时间框架,所以我认为至少要到2019年12月中旬才能修复。这就是里程碑-