MVC Mini Profiler包括不尊重应用程序的路径
-
26-10-2019 - |
题
我已经在其上所述设置了MVC Mini Profiler 项目页面, ,其中的确写在页面上。
问题是,我的应用程序位于 http://localhost:8080/web
, ,以及剖面图所写的标记包括这样的外观:
<link rel="stylesheet/less" type="text/css" href="/mini-profiler-includes.less?v=2.0.4177.17902">
<script type="text/javascript" src="/mini-profiler-includes.js?v=2.0.4177.17902"></script>
<script type="text/javascript"> jQuery(function() { MiniProfiler.init({ id:'fb4dc30e-c1aa-4be6-902c-ef2812dd1fe2', renderDirection:'left' }); } ); </script>
所有这些当然会出现404个错误,但是如果我导航到 /web/mini-profiler-includes.less?
, ,加载正常。
可以找到字符串的来源 这里:
// MiniProfilerHandler.cs
/// <summary>
/// Understands how to route and respond to MiniProfiler UI urls.
/// </summary>
public class MiniProfilerHandler : IRouteHandler, IHttpHandler
{
internal static HtmlString RenderIncludes(MiniProfiler profiler, RenderPosition? position = null, bool showTrivial = false, bool showTimeWithChildren = false)
{
const string format =
@"<link rel=""stylesheet/less"" type=""text/css"" href=""{0}mini-profiler-includes.less?v={1}"">
<script type=""text/javascript"" src=""{0}mini-profiler-includes.js?v={1}""></script>
<script type=""text/javascript""> jQuery(function() {{ MiniProfiler.init({{ id:'{2}', path:'{0}', renderDirection:'{3}', showTrivial: {4}, showChildrenTime: {5} }}); }} ); </script>";
var pos = position ?? (MiniProfiler.Settings.RenderPopupButtonOnRight ? RenderPosition.Right : RenderPosition.Left);
var result = profiler == null ? "" : string.Format(format,
EnsureEndingSlash(HttpContext.Current.Request.ApplicationPath),
MiniProfiler.Settings.Version,
profiler.Id,
pos.ToString().ToLower(),
showTrivial ? "true" : "false",
showTimeWithChildren ? "true" : "false");
return new HtmlString(result);
}
// rest of the code
}
为什么不申请返回我的应用程序路径?我是做错了什么,还是应该在MVC Mini-Profiler页面上提出问题?
编辑: 为了使事情变得更奇怪,我在 MiniProfiler.RenderIncludes()
呼叫,并检查了什么价值 HttpContext.Current.Request.ApplicationPath
那时,那是 "/web"
呢非常神秘。
编辑2: :看起来他们可能在最新版本(2小时前:))中添加了对虚拟路径的支持,而Nuget软件包(这是我安装它的方式)并非完全最新。调查...
解决方案
提取最新消息来源(这个提交 作为本文帖子时的最新),构建项目,抓住DLL并引用,而不是使用该项目的Nuget软件包解决了问题。
编辑: :截至目前,Nuget软件包现在已与最新的提交有关,所以Nuget离开了!
不隶属于 StackOverflow