【问题标题】:NHibernate profiler doesnt fetch my sessionsNHibernate 探查器不获取我的会话
【发布时间】:2012-03-28 10:25:56
【问题描述】:

我刚刚下载了 nhibernate profiler,但我不知道为什么它不起作用。 据我所知,在选项 - 编辑默认连接中设置连接字符串就足够了。

我正在使用 sql server,我已经像这样复制了我的连接字符串

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

在我的应用程序的调试模式下,执行我的应用程序时,我在 nhibernate 分析器中没有任何内容。

更新: 添加了对我的 mvc3 项目的引用

HibernatingRhinos.Profiler.Appender.v4.0.dll

全球.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 端口来设置我的 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()

【问题讨论】:

    标签: nhibernate


    【解决方案1】:

    您是否在您的应用/网站中初始化了 NHibernateProfiler?

    Appliction_Start() 或 Main() 中的类似内容

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

    还要记得引用dll

    HibernatingRhinos.Profiler.Appender.v4.0.dll
    

    【讨论】:

    • 当然不是 :) 我使用 mvc3 它应该在 global.asax 的 Application_Start() 中。我试试看
    • 运气不好。我添加了 HibernatingRhinos.Profiler.Appender.v4.0.dll 和 Application_Start() #if DEBUG HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize(); #endif 是否需要修改 web.config
    • 不对 web.config 进行编辑。也许是一个愚蠢的问题,但是您是否在发布模式下进行测试?因为我写的内容只有在调试模式下才有效,因为“if DEBUG”条件。
    • 作为其他试用版,请尝试使用 HibernatingRhinos.Profiler.Appender.dll 而不是 4.0 版本。如他们的Getting started所述
    • @Irido 仍然一无所有。我尝试使用这些 HibernatingRhinos.Profiler.Appender.dll 而不是 4.0 版。再次更新问题。有什么想法吗?
    【解决方案2】:

    在选项设置中返回默认侦听端口后,一切正常。最后。谢谢@Iridio。

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

    第1步:添加参考

    第 2 步:在 Global.asax Application_Start() 中添加这些行

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

    第 3 步:启动 NhProf,在 Options-Connection 字符串中添加您的 conn.string。

    第 4 步:运行您的应用。

    默认监听端口为22897,请勿更改。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-12-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-21
      • 1970-01-01
      相关资源
      最近更新 更多