asp.net-mvc – 迷你探查器不显示ajax请求信息?
发布时间:2020-12-16 06:38:07 所属栏目:asp.Net 来源:网络整理
导读:我在我的asp.net MVC 3应用程序上使用mini-profiler.我使用mvc nuget包实现了探查器.一切都适用于标准页面请求我获取配置文件信息sql一切. 但是,最初似乎没有显示ajax请求.只是让我确认请求已经完成而没有错误.我调试了这个,他们完成了他们也在fiddler中返回
我在我的asp.net MVC 3应用程序上使用mini-profiler.我使用mvc nuget包实现了探查器.一切都适用于标准页面请求我获取配置文件信息sql一切.
但是,最初似乎没有显示ajax请求.只是让我确认请求已经完成而没有错误.我调试了这个,他们完成了他们也在fiddler中返回http 200响应. ajax请求附带的迷你探查器没有请求.当我然后导航到另一个页面,即标准页面请求时,现在显示在最后一页上进行的所有ajax请求. 这是我在App_Start中的迷你探查器配置页面 public static class MiniProfilerPackage { public static void PreStart() { //Setup sql formatter MiniProfiler.Settings.SqlFormatter = new OracleFormatter(); //Make sure the MiniProfiler handles BeginRequest and EndRequest DynamicModuleUtility.RegisterModule(typeof(MiniProfilerStartupModule)); //Setup profiler for Controllers via a Global ActionFilter GlobalFilters.Filters.Add(new ProfilingActionFilter()); //Settings MiniProfiler.Settings.PopupShowTimeWithChildren = true; MiniProfiler.Settings.PopupShowTrivial = false; //Ignore glimpse details in miniprofiler var ignored = MiniProfiler.Settings.IgnoredPaths.ToList(); ignored.Add("Glimpse.axd"); MiniProfiler.Settings.IgnoredPaths = ignored.ToArray(); } public static void PostStart() { // Intercept ViewEngines to profile all partial views and regular views. // If you prefer to insert your profiling blocks manually you can comment this out var copy = ViewEngines.Engines.ToList(); ViewEngines.Engines.Clear(); foreach (var item in copy) { ViewEngines.Engines.Add(new ProfilingViewEngine(item)); } } } public class MiniProfilerStartupModule : IHttpModule { public void Init(HttpApplication context) { context.BeginRequest += (sender,e) => { var request = ((HttpApplication)sender).Request; MiniProfiler.Start(); }; //Profiling abadened if user is not in the admin role context.PostAuthorizeRequest += (sender,e) => { if (!context.User.IsInRole("Admin")) MiniProfiler.Stop(discardResults: true); }; context.EndRequest += (sender,e) => { MiniProfiler.Stop(); }; } public void Dispose() { } } 是否有一些必要的配置或我应该注意的潜在问题? 解决方法
最后,我发现添加到页面的Miniprofiler JavaScript块必须低于页面jquery引用.
出于最佳实践性能原因,我的JavaScript参考都在页面末尾添加. 但是我在页眉中留下了@ MvcMiniProfiler.MiniProfiler.RenderIncludes().将它移动到页面底部的jquery脚本ref下面修复了我的问题. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-mvc – 在Html.BeginForm()中使用RouteValueDicton
- asp.net-mvc – 在kendo模板中渲染剑道控件(Razor)
- asp.net-mvc – MVC 5防止通过iframe访问内容
- ASP.NET MVC 2 – ViewModel前缀
- asp.net-mvc – 在ASP.NET MVC中上传多个图像文本字段
- asp.net-mvc-3 – 由Enter按钮触发的MVC3输入按钮
- asp.net-mvc – asp.net mvc – 缓存
- asp.net – IE bug无效源HTML5音频 – 解决方法
- asp.net-mvc – 当model是父模型上的属性且为null时,强类型
- asp.net-mvc – localhost拒绝在visual studio中连接Error
推荐文章
站长推荐
- asp.net-mvc-3 – 为什么会话是ASP.NET MVC应用程
- asp.net – 如何在VB.NET中JSON编码数组?
- asp.net – 与WCF和其他Web服务有什么区别?
- 如何将ASP.NET用户和路由数据传递给JavaScript?
- asp.net-core – ASP.NET Core / MVC6中的WebTel
- asp.net中的Html.ActionLink MVC对象值格式错误
- asp.net – aspx.designer.cs它是如何工作的?
- 将配置文件appsetting中的值转换为动态对象调用
- asp.net-mvc-4 – 如何在ASP.NET MVC中使用React
- ASP.NET上的ASP.NET未来?
热点阅读