views:

65

answers:

2

Hi,

I have a site running MVC and Nhibernate (not fluent) using standard session per request in an http module, runs fine locally (also with mysql) but after a move to a hosting provider no update statements are being issued.

I can insert but not update, no exceptions are raised, I have the 'show_sql' option switched on which locally shows the update statements being issued but on the server no update statements are logged.

I don't think NHProf is an option for me as I can only run asp.net apps on my shared server, are there any other methods of diagnosing NH issues like this ?

Anyone had a similar issue ?

Cheers,

A

A: 

NHProf is an option for you!

You can have it log to a file, then pick that file up later. This is the log4net config you need:

<log4net>
  <appender name="NHProfAppender"
    type="HibernatingRhinos.Profiler.Appender.NHibernate.NHProfOfflineAppender, 
    HibernatingRhinos.Profiler.Appender" >
    <file value="nhprof_output.nhprof" />
  </appender>

  <logger name="HibernatingRhinos.Profiler.Appender.NHibernate.NHProfAppender.Setup">
    <appender-ref ref="NHProfAppender"/>
  </logger>
</log4net>

Alternatively, if you don't have an NHProf license, you can log the NHibernate stuff to a file in order to see what's happening.

James L
Cheers for the info, it's useful to know I can run NHProf on a shared server if I need to in future. See below on how I resolved this issue.
Andy LifeBrixx
No problem. If you found it useful maybe you could upvote, even if you don't accept the answer ;)Not sure how you managed to insert without a session though!
James L
A: 

The issue was that I had moved from my local dev environment with IIS5 to a shared server with IIS7, IIS7 has a different syntax for registering http modules so my NHibernate session module was not firing which caused the behaviour originally described.

To fix this problem I added the modules section in the web.config under system.web to system.webServer, you can add the validation validateIntegratedModeConfiguration="false" key to the system.webServer section which will allow your config to have the module registered under both sections so you can have the same config for IIS5/IIS7.

Andy LifeBrixx