我正在运行umbraco 7的实例.但我似乎无法设置miniprofiler来使用它.
在我的global.asax上设置它:
protected void Application_BeginRequest()
{
if (Request.IsLocal)
{
MiniProfiler.Start();
}
}
protected void Application_EndRequest()
{
MiniProfiler.Stop();
}
Run Code Online (Sandbox Code Playgroud)
还定义了web.config上的处理程序:
<add name="MiniProfiler" path="mini-profiler-resources/*" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
Run Code Online (Sandbox Code Playgroud)
真的很感激任何帮助.
StackExchange MiniProfiler http://code.google.com/p/mvc-mini-profiler/在ASP.NET MVC2中工作吗?如果是这样,怎么样?将MiniProfiler添加到项目中时,MVC2相当于:
@MvcMiniProfiler.MiniProfiler.RenderIncludes()
Run Code Online (Sandbox Code Playgroud) 我们正在优化网站,并且已经阅读了很长时间内初始视图查找的问题.然后,对视图的后续查找要快得多.Mini-profiler显示很多时候都在初始查找视图中(我知道我可以使用~path来减少这个)以及在此阶段完成的任何其他工作.
缓存在哪里完成?视图查找等缓存了多长时间?我能看到缓存的内容吗?我们可以做任何事情来导致它预加载,所以没有延迟吗?
我们有很多观点,通常几个小时都没有访问过,我不希望突然出现高峰和低谷.
我们使用Azure并拥有许多Web角色实例.我可以假设每个Web角色都有自己的视图查找缓存吗?我们可以集中缓存,以便每个应用程序只发生一次吗?
另外我读MVC4更快找到视图?有人有任何数据吗?
我安装了Glimpse(Glimpse MVC4)和MiniProfiler(支持EF).
我还为Glimpse安装了MiniProfiler插件.
我有所有连线和工作.我想允许Glimpse的配置来确定MiniProfiler是否应该开始分析.也就是说,如果启用了Glimpse(通过Glimpse.axd而不是通过配置设置),我想在Application_BeginRequest()方法中调用MiniProfiler.Start().所以,像这样:
protected void Application_BeginRequest()
{
if (Glimpse.IsRunning)
{
MiniProfiler.Start();
}
}
Run Code Online (Sandbox Code Playgroud)
有没有办法确定是否启用了Glimpse?
我添加了迷你分析器,并且能够查看所有请求的时间安排。我可以使用 Miniprofiler 显示跟踪消息(或与此相关的任何其他自定义信息)吗?请帮忙看看可能性。我在 MVC3 .net C# 网站中使用它。
我想使用MiniProfiler计算Application_OnStart.到目前为止,我一直没有成功.我试图创建一个Timing并将其添加到root的子节点,但它不会收集我想要的所有数据.它还会从整体配置文件时间中减去启动时间,因此最终会显示负的持续时间.目前我唯一的解决方案是使用秒表计时并将其添加到客户端计时.这将从第一个请求中删除客户端计时,并添加应用程序启动持续时间.但我没有获得自定义时序等.此外,因为我使用AddProfilerResults方法在我的MVC配置文件中组合我的API配置文件(对于MVC UI,它们包含在步骤中),第一个MVC上API的启动时间请求不包括在内,它基本上丢失了.
MiniProfiler.Current.ClientTimings = new ClientTimings
{
Timings = new List<ClientTimings.ClientTiming>
{
new ClientTimings.ClientTiming
{
Duration = startTime,
Id = Guid.NewGuid(),
MiniProfilerId = Guid.NewGuid(),
Name = "Application_Start",
Start = 0
}
}
};
Run Code Online (Sandbox Code Playgroud) 所以我正在尝试将 MiniProfiler ( https://github.com/MiniProfiler/dotnet ) 用于 WebForms 网站。我所做的是:
添加 <%= StackExchange.Profiling.MiniProfiler.RenderIncludes() %> 语句
设置在 web.comfig
而且仍然 MiniProfiler 不起作用。简单的故障排除显示(在 Chrome 开发工具中)在该页面上我希望看到 MiniProfiler,我看到
http://localhost/mycoolsite/mini-profiler-resources/results 404.0 - 未找到
更多信息:我使用 .Net FW 4.5.1、IIS8 和 Intergated Mode(应用程序池)
任何想法可能对我有用?
鉴于 MiniProfiler 实际上并未针对非本地请求运行,原因如下:
protected void Application_BeginRequest()
{
if (Request.IsLocal)
MiniProfiler.Start();
}
Run Code Online (Sandbox Code Playgroud)
ProfiledDbConnection那么(在性能方面)在生产代码中保留使用还可以吗?
var db = new MyDataContext(new StackExchange.Profiling.Data.ProfiledDbConnection(new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString), MiniProfiler.Current))
Run Code Online (Sandbox Code Playgroud) asp.net-mvc performance profiling linq-to-sql mvc-mini-profiler
为此,花费更多的时间来梳理SO.这是设置
这就是我在存储库中创建Db Context的方式
public class TransactionRepository : BaseRepository, ITransactionRepository
{
AccountingEntities _db = new AccountingEntities();
// repository methods
}
Run Code Online (Sandbox Code Playgroud)
然后在控制器中
public class InvoiceController : BaseController
{
private ITransactionRepository _txnRepository;
public InvoiceController()
{
_txnRepository = new TransactionRepository();
}
public InvoiceController(ITransactionRepository t)
{
_txnRepository = t;
}
}
Run Code Online (Sandbox Code Playgroud)
最后,我已添加到web.config
<system.data>
<DbProviderFactories>
<remove invariant="MvcMiniProfiler.Data.ProfiledDbProvider" />
<add name="MvcMiniProfiler.Data.ProfiledDbProvider" invariant="MvcMiniProfiler.Data.ProfiledDbProvider" description="MvcMiniProfiler.Data.ProfiledDbProvider" type="MvcMiniProfiler.Data.ProfiledDbProviderFactory, MvcMiniProfiler, Version=1.8.0.0, Culture=neutral, PublicKeyToken=b44f9351044011a3" />
</DbProviderFactories>
</system.data>
Run Code Online (Sandbox Code Playgroud)
分析这些连接的后续步骤是什么?慢慢来,因为这是我第一次接触实体框架,所以假设EF连接/上下文细节很少.
entity-framework-4.1 database-first ef-database-first mvc-mini-profiler
我尝试使用EF Tracing Provider检查生成的SQL语句,但现在我想使用MiniProfiler,但是我无法看到结果......
到目前为止我做了什么:
Intalled包:

取消注释MiniProfiler.cs中的初始化
Run Code Online (Sandbox Code Playgroud)public static void PreStart() { //... //TODO: If you are profiling EF code first try: MiniProfilerEF.Initialize(); //... }
在布局视图中添加了渲染(在关闭body标签之前):
@MiniProfiler.RenderIncludes()
Run Code Online (Sandbox Code Playgroud)但是相对于miniprofiler,浏览器中没有显示任何内容......我正在使用数据库优先方法.
我错过了什么吗?
c# ×3
asp.net-mvc ×2
.net ×1
azure ×1
glimpse ×1
linq-to-sql ×1
miniprofiler ×1
performance ×1
profiling ×1
umbraco ×1
umbraco7 ×1
webforms ×1