Cannot load HTTPModule

Aug 19, 2009 at 7:07 PM

I admit that I am quite clueless at the moment.  I have been developing my first web app along with my first NHibernate app and I am currenlty dealing with several issues.  Currently I am being told that

Parser Error Message: Could not load type 'NYA.Detention.NhibernateRepository.NHibernateHttpModule'

The problems started with not being able to get the current session - and have led to the above error when I added the

<add name="NHibernateHttpModule" type="NYA.Detention.NhibernateRepository.NHibernateHttpModule"/> line to the web config file.

I have done my best to follow your pdf and sample.  I have your sample working but am stuck.


Could anyone help with providing direction toward likely issues that could cause this.

Thank you, Dennis Childers

Aug 19, 2009 at 8:19 PM

An update - I moved past the issue first posted by replacing the web.config line first posted with the following:

<font size="2" color="#0000ff"><font size="2" color="#0000ff">


</font></font><font size="2" color="#0000ff">



add name="NHibernateHttpModule" type="NYA.Detention.NHibernateRepository.NHibernateHttpModule, NYA.Detention.NHibernateRepository"/>

Note the additional phrase at the end AND the new capital "H" in the word NHibernate.

Like I said I am pretty much clueless.  Now my page loads but is empty - I mean the data grid is just empty.  Below is my nhibernate configuration section from the web.config file.  I have removed the security part of the connection string, but that is my user id and password.  Can anyone see anything wrong?  I am using SQL server 2005 and it is a database that has been running for several years.

<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">


<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>

<property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>

<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>

<property name="connection.connection_string">Data Source=GRIM;Initial Catalog=CoreReplica;</property>

<property name="current_session_context_class">web</property>

<property name="show_sql">true</property>





Aug 19, 2009 at 8:47 PM

I know this is getting a bit silly - sorry.  I have verified that the session has a valid connection to the correct database, so I don't think the configuration is the problem.  I know that there is one sample record in the dtat table I am trying to return but the Findall function of the base repositoey does not find it.  What could be the problem?  I have been at this all day - skipped lunch - getting a bit woosy(is that a real word?).  Any help would be appreciated.


Thanks Dennis Childers

Aug 19, 2009 at 11:53 PM

Hi Dennis,

Check you command output window to see what SQL (if any) NHibernate is producing - this achieved by the "show_sql" property in your config settings. Then copy and run the SQL in a query window against your database dirtectly. Maybe your mappings have a lot of joins and so not finding any data.


Aug 20, 2009 at 2:54 PM

Hello Scott-Thanks very much for your help.

I had the show_sql set to true in both my app and your sample app.  Neither one showed any sql in the output window.  I had not set up logging in my app so I did so following your sample with log4net.  When I ran my app, it created the log file but no sql showed up in the log file.  When I ran your sample, a SQL query did show up in the log file.  So where to now?  I tried to post my object code and mapping file but the site choked when trying to save it.  I could email you with or maybe try one file at a time?

Thanks again,

Dennis Childers

Aug 28, 2009 at 3:00 PM

Just Wondering Scott - have you given up on my problem - it remains unresolved


Thanks, Dennis Childers

Aug 28, 2009 at 5:23 PM
Hi no not given up, just got back from my mini moon, send me the code to Scott at elbandit dot co dot uk


Sent from my iPhone

On 28 Aug 2009, at 15:00, dchilders <> wrote:

From: dchilders

Just Wondering Scott - have you given up on my problem - it remains unresolved

Thanks, Dennis Childers

Sep 1, 2009 at 5:52 PM

Hi Dennis,

It looks like the Build Action of your mapping files are all set to "content" these need to be changed to "Embedded Resource". This will embed the *.hbm.xml files into your assembly. To do this right click on each of the *.hbm.xml files in the Mapping Files folder of the NHibernateRepository project and select Properties then change the Build Action to Embedded Resource.

You will get a load of different errors due to some of your mappings, but you should be able to figure these out, if not start simple and get one table to display then add relationships to other tables later so you know you have the basics working.

If you get stuck give me a mail.