5

I'm using NHProf with ASP.NET MVC 3.

I inserted

HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize();

in my Application_Start method, but NHProf still doesn't see my sessions and doesn't show up anything.

What could be the source of my problem?

GaGar1n
  • 1,040
  • 2
  • 10
  • 17
  • Sanity check - have you debugged it and seen that your line of code is executed? Do you have NHProf open - and also is it profiling/listening? – Dave Walker Dec 07 '11 at 10:51
  • Yes, I did. I don't know if NHProf is profiling/listening, it just says "Recording..." which I think means that it's listening. – GaGar1n Dec 07 '11 at 12:49

3 Answers3

5

Please make sure that the NHibernate Profiler client points to the same port as your NHibernateProfiler.Initialize() method. The default port is 22897.

Fitzchak Yitzchaki
  • 9,095
  • 12
  • 56
  • 96
  • Yes, it points to `22897`. Is there any way I can change it to some other port? – GaGar1n Dec 07 '11 at 10:39
  • Yes, through the settings dialog (Options > Settings). – Fitzchak Yitzchaki Dec 07 '11 at 15:33
  • 1
    I was tearing my hair out over this! NHProf just sat there, recording but showing no sessions or queries. Opened Options > Settings from the menu and changed Listen Port to 22897 and it worked! This was originally set to port 0. Weird I wonder if that's an install problem, all I did at install time was to unzip the exe and all ancillary files. Should perhaps be part of the NHProf getting started page: http://www.hibernatingrhinos.com/products/nhprof/learn/general/gettingstarted. – A. Murray Jun 26 '13 at 08:03
  • 1
    There was a bug in the latest build which made this possible. In the next build this is fixed. It will make sure that the port will be 22897 by default, as it should. – Fitzchak Yitzchaki Jun 26 '13 at 08:16
  • Hi, Fitzchak Yitzchaki, yes this has come to my attention, my colleagues have never had to set the port themselves. Thanks! – A. Murray Jun 26 '13 at 09:27
1

Do you setup a log4net configuration?

You can look here:

How do I configure NHibernate Profiler so I can enable/disable it without changing code?

And sample from my web.config:

<appender name="NHProfAppender"
      type="HibernatingRhinos.Profiler.Appender.NHibernate.NHProfAppender, 
      HibernatingRhinos.Profiler.Appender.NHibernateLog4Net">
    <sink value="tcp://127.0.0.1:22897" />
  </appender>
  <logger name="HibernatingRhinos.Profiler.Appender.NHibernate.NHProfAppender.Setup">
    <appender-ref ref="NHProfAppender"/>
  </logger>
Community
  • 1
  • 1
Baidaly
  • 1,829
  • 1
  • 15
  • 16
  • I believe that Fitzchak's answer is more relevant, the solution shouldn't involve an extra piece of software (log4net) or configuration that may not be required to solve the problem. – A. Murray Jun 26 '13 at 08:08
0

Could be a firewall issue? Make sure the port is the same and the port can be accessed. Your latest code is running as expected?

Colin Asquith
  • 653
  • 1
  • 6
  • 13