2012-03-28 23 views
5

我刚刚下载了nhibernate分析器,我不知道为什么它不工作。 据我所知,它应该足以在选项 - 编辑默认连接中设置连接字符串。NHibernate profiler does not抓取我的会话

我使用的是SQL Server和我抄我的连接字符串这样

Data Source=.\SQLEXPRESS;Initial Catalog=DB_xxx_MyDb;Integrated Security=True; 

在我的应用程序的调试模式我执行我的应用程序时,有NHibernate的探查里面什么都没有。

更新: 新增参考我的MVC3项目

HibernatingRhinos.Profiler.Appender.v4.0.dll 

的Global.asax

protected void Application_Start() 
{ 
    AreaRegistration.RegisterAllAreas(); 
    RegisterGlobalFilters(GlobalFilters.Filters); 
    RegisterRoutes(RouteTable.Routes); 
    #if DEBUG 
    HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize(); 
    #endif 
} 

我做以下步骤

  1. 开始NhProf.exe
  2. 开始调试mvc应用程序,我想要配置这些应用程序查询

Nhibernate概要分析器中没有显示任何内容。许可证正在工作32天。 为什么?我还应该做什么?

第二次更新: 我试着参考HibernatingRhinos.Profiler.Appender.dll仍然没有工作。 尝试使用options-settings-listen port来设置我的asp开发。服务器端口,现在是5442. 还没有。我有点困惑。

只是提一提,我的应用程序的作品,我的连接字符串的工作,我能够从我的数据库获取数据,...

NHProfiler文件夹中我的log.txt文件有这样的内容

2012-03-28 20:31:01,374 [1] INFO Rhino.Licensing.LicenseValidator [(null)] - License expiration date is 04/29/2012 00:00:00 
2012-03-28 20:31:01,662 [1] DEBUG Rhino.Licensing.LicenseValidator [(null)] - License accepted for NHibernate Profiler 
2012-03-28 20:31:02,461 [6] INFO HibernatingRhinos.Profiler.Client.App [(null)] - Checking for updates... 
2012-03-28 20:31:25,072 [4] ERROR HibernatingRhinos.Profiler.Client.App [(null)] - Error while checking for updates: System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 216.121.112.229:80 
    at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) 
    at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) 
    --- End of inner exception stack trace --- 
    at System.Net.HttpWebRequest.GetResponse() 
    at NAppUpdate.Framework.Sources.SimpleWebSource.GetUpdatesFeed() 
    at NAppUpdate.Framework.UpdateManager.CheckForUpdates(IUpdateSource source, Action`1 callback) 
    at NAppUpdate.Framework.UpdateManager.<>c__DisplayClass2.<CheckForUpdateAsync>b__1() 

回答

6

你初始化了NHibernateProfiler在您的应用程序/网站?

像这样的事情在Applicattion_Start()或主()

#if DEBUG 
    HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize(); 
#endif 

还记得基准的DLL

HibernatingRhinos.Profiler.Appender.v4.0.dll 
+0

ofcourse not :)我使用mvc3它应该在Global.asax中的Application_Start()内。我会给它尝试 – BobRock 2012-03-28 10:31:24

+0

没有运气。我加入HibernatingRhinos.Profiler.Appender.v4.0.dll 和内部的Application_Start()#如果DEBUG HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize(); #ENDIF 我是否需要修改的web.config – BobRock 2012-03-28 10:41:01

+0

没有编辑到web.config。也许是一个愚蠢的问题,但是你在发布模式下测试?因为我写的东西只有在调试模式下才起作用,因为“如果DEBUG”条件。 – Iridio 2012-03-28 12:08:12

3

内选项的设置一切正常返回默认的监听端口后。最后。谢谢@Iridio。

顺便说一句,如果有人需要得出结论:

步骤1:添加参考

步骤2:在内部的Global.asax的Application_Start()添加这些线

#if DEBUG 
      HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize(); 
#endif 

步骤3:启动NhProf,在Options-Connection字符串里面添加你的conn.string。

第4步:运行您的应用程序。

默认侦听端口是22897.不要更改它。

+0

很高兴你整理了一下 – Iridio 2012-03-28 20:17:51