使用MiniProfiler对NHibernate进行数据库分析的最简单方法是什么?为了让探查器工作,我需要包装DbConnectionNHibernate在a中使用的ProfiledDbConnection.
我不太熟悉NHibernate的内部,所以我不知道所有的可扩展性点在哪里.(我注意到NHibernate ISession有一个Connection属性,但它是只读的.)
最近我们从v1.7升级到MiniProfiler版本2.0.1,从那以后我们无法在我们的MVC3网站中使用它,因为当它试图获取其资源时,它获得了404.
示例资源调用是: /mini-profiler-resources/includes.js?v=tNlJPuyuHLy/d5LQjyDuRbWKa0weCpmO3xkO6MH4TtA=
在搜索时,大多数人都建议只需将设置runAllManagedModulesForAllRequests设置为true.对于咯咯笑,我继续把它设置为真,是的,它确实有效.但这不是一个可以接受的答案.
我如何保持runAllManagedModulesForAllRequests=false并仍然使用MiniProfiler v2?
我是一个大风扇MiniProfiler通过贾罗德Dixon和堆栈溢出团队ASP.NET创建.是否有Rails应用程序的端口?
由于探查器的核心是JavaScript,JQuery.tmpl和Less似乎将后端移植到Rails是相当直接的,前端已经完成.


前端体系结构允许通过将自定义标识符附加到自定义标头(X-MiniProfiler-Ids)中的每个请求来进行POST和AJAX请求分析.
Python和GAE 有一个类似的端口.
尽管Rack Bug相当有趣,但UI并不富有 - 没有POST和AJAX支持,没有用于分析块的API,也不建议在生产中使用.
同样,生产中不支持开发模式下的 NewRelic,并且没有在每个页面上呈现的着名的MiniProfiler"chicklet".
Rails中是否有MiniProfiler端口?
我刚刚开始使用mvc-mini-profiler(http://code.google.com/p/mvc-mini-profiler/),我觉得它很棒.但是,我在使用它时会遇到一些奇怪的行为.
我有一个在IIS7.5上运行的ASP.NET Webforms站点,出于某种原因,当我加载启用了探查器的页面时,我不仅得到了aspx页面的时间测量,而且我也得到了随机css和页面上的js资源.
aspx配置文件正常工作,SQL查询也正确分析.但是,如图所示,我还得到了一堆其他结果,这些结果似乎是静态CSS和JS文件的结果.据我所知,这些是由IIS静态提供的,因此甚至不应该为这些调用探查器代码.
我的Global.asax的相关部分是:
protected void Application_BeginRequest()
{
MiniProfiler profiler = null;
// might want to decide here (or maybe inside the action) whether you want
// to profile this request - for example, using an "IsSystemAdmin" flag against
// the user, or similar; this could also all be done in action filters, but this
// is simple and practical; just return null for most users. For our test, we'll
// profile only for local requests (seems …Run Code Online (Sandbox Code Playgroud) 我有一个MVC3项目,我从VS2010升级到VS2012.该项目也有参考MiniProfiler.我们的应用程序在VS2012中编译并运行良好,没有任何警告/错误.使用IIS Express运行时,两个程序集都可以正常加载 但是,在使用ASP.NET编译器工具时,我收到以下警告:
Microsoft(R)ASP.NET编译工具版本4.0.30319.17929预编译ASP.NET应用程序的实用程序版权所有(C)Microsoft Corporation.版权所有.
(0):警告:以下程序集依赖于高于目标的.NET Framework版本,并且可能在运行时导致失败时无法正确加载:MiniProfiler,Version = 2.1.0.0,Culture = neutral,PublicKeyToken = b44f9351044011a3.依赖项为:System.Data.Linq,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089.您应该确保依赖程序集对于目标框架是正确的,或者确保要处理的目标框架是从属程序集的目标框架.
我们没有明确的参考System.Data.Linq.直到VS2012更新,我们没有任何错误.该MiniProfiler版本确实以.NET 4.0为目标(我们的应用程序也是如此).可能导致此警告的原因是什么?
我正在使用ASP.Net MVC 3和Entity Framework代码优先构建的项目中使用mvc-mini-profiler.
一切都很有效,直到我尝试通过ProfiledDbConnection在文档中描述的方式包装连接来添加数据库分析.由于我使用的是DbContext,因此我尝试提供连接的方式是使用静态工厂方法构造函数:
public class MyDbContext : DbContext
{
public MyDbContext() : base(GetProfilerConnection(), true)
{ }
private static DbConnection GetProfilerConnection()
{
// Code below errors
//return ProfiledDbConnection.Get(new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnectionName"].ConnectionString));
// Code below works fine...
return new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnectionName"].ConnectionString);
}
//...
}
Run Code Online (Sandbox Code Playgroud)
使用时ProfiledDbConnection,我收到以下错误:
ProviderIncompatibleException: The provider did not return a ProviderManifestToken string.
堆栈跟踪:
[ArgumentException: The connection is not of type 'System.Data.SqlClient.SqlConnection'.]
System.Data.SqlClient.SqlProviderUtilities.GetRequiredSqlConnection(DbConnection connection) +10486148
System.Data.SqlClient.SqlProviderServices.GetDbProviderManifestToken(DbConnection connection) +77
System.Data.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +44
[ProviderIncompatibleException: The provider did not …Run Code Online (Sandbox Code Playgroud) 我有一个问题,我们在现有数据库中使用EF 4.3 Code First.我想使用带有EF的Mini-Profiler并打电话
MvcMiniProfiler.MiniProfilerEF.Initialize();
Run Code Online (Sandbox Code Playgroud)
但是,由于我们实际上没有创建任何表,因此dbo .__ MigrationHistory和dbo.EdmMetadata表不存在.探查器最终崩溃,因为它们不存在.有没有办法让探查器忽略这些EF Code First特定的表?谢谢!
编辑:
这些是我得到的例外:(它们分开来)
Invalid object name 'dbo.__MigrationHistory'.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at …Run Code Online (Sandbox Code Playgroud) 我一直在使用MiniProfiler来测量网站性能.当我从1.9版升级到2.0版时,它停止了工作.我将命名空间从MvcMiniProfiler更改为StackExchange.Profiling.但是当我加载页面时,fiddler显示以下请求有404错误:
GET /local/mini-profiler-resources/jquery.1.7.1.js?v=tNlJPuyuHLy/d5LQjyDuRbWKa0weCpmO3xkO6MH4TtA=HTTP/1.1
这可以防止在页面中呈现结果.
要获得1.9版本MiniProfiler的工作,我不得不在web.config文件中的以下条目(如在描述这个职位):
<system.webServer>
<handlers>
<add name="UrlRoutingModule1" path="mini-profiler*.js" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
<add name="UrlRoutingModule2" path="mini-profiler*.css" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
<add name="UrlRoutingModule3" path="mini-profiler*.tmpl" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
</handlers>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)
我试图让MiniProfiler 2.0与配置文件中包含的那些一起运行并排除它们,但两种方式都没有用.
这是在IIS Express中的我的开发机器上运行的.
我的应用程序是一个使用Forms安全性的WebForms应用程序.
我该如何解决这个问题?
我有一个扩展方法在DbContext我想要做的地方SqlBulkCopy.因此我需要一个SqlConnection.来自DbContext的连接来自类型DbConnection.在其他一些事情我试过这个:
var connection = new SqlConnection( dbContext.Database.Connection.ConnectionString);
Run Code Online (Sandbox Code Playgroud)
问题是密码丢失(可能出于安全原因).
我尝试的另一件事是向上转换:
var bulk_copy = new SqlBulkCopy( (SqlConnection)dbContext.Database.Connection );
Run Code Online (Sandbox Code Playgroud)
这实际上假设DbConnection是一个SqlConnection.在这个非常具体的案例中,它已经出错了.我正在使用MVC MiniProfiler将连接包装成一个EFProfiledDbConnection.EFProfiledDbConnection不从SqlConnection继承.
还有其他想法吗?提前致谢!
我想将MVC MiniProfiler的结果保存到sql server数据库.我分析了一个高负载的mvc4页面,以发现一个棘手的性能问题,这个问题在我们的测试或开发系统上是不可重现的,只是偶尔在生产服务器上发生.
连接迷你探查器的最佳方法是什么?是否有现成的扩展名?
asp.net-mvc ×3
c# ×3
asp.net ×2
.net ×1
binding ×1
nhibernate ×1
profiling ×1
sql ×1
web-config ×1