Hi i created a small web project that run fine on my local PC (this happens to the bigger site also) but somehow i cannot port it to the web server the only thing i get from web server is this:
Code:
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
i tried to change the webconfig with no luck :(
(P.S. if i don't use nhibernate everything runs fine)
Here is my code:
Code:
Mapping:
using NHibernate.Mapping.Attributes;
[Class(Table = "[Product]", NameType = typeof(Product))]
public class Product
{
public Product()
{
}
[Id(Name = "ProductId", Column = "ProductId")]
virtual public int ProductId { get; set; }
[Property(Column = "ProductName")]
virtual public string ProductName { get; set; }
}
Code:
Global class that i run from global.asax
public class Global : System.Web.HttpApplication
{
public Global()
{
}
public static ISessionFactory SessionFactory { get; private set; }
protected void Application_Start(object sender, EventArgs e)
{
if (SessionFactory == null)
{
var config = new Configuration();
config.Configure();
config.AddInputStream(HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly()));
SessionFactory = config.BuildSessionFactory();
}
}
}
Code:
Default.aspx
IList<Product> pl;
protected void Page_Load(object sender, EventArgs e)
{
using (ISession session = Global.SessionFactory.GetCurrentSession())
{
using (ITransaction tx = session.BeginTransaction())
{
IQuery query = session.CreateQuery("FROM Product");
pl = query.List<Product>();
}
}
l.Text = pl[0].ProductName;
}
Code:
Web config related parts
1) <section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"/>
2) <httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="NHibernateSessionModule" type="NHibernateSessionModule, App_Code"/>
</httpModules>
3) <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="dialect">NHibernate.Dialect.MsSql2008Dialect</property>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<!--<property name="connection.connection_string">Server=(local);initial catalog=Zip_m_Db;Integrated Security=SSPI</property>-->
<property name="connection.connection_string">Server=62.219.7.21;initial catalog=zip_drink_Db;User ID=xxxx;Password=xxxx;</property>
<property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
<property name="current_session_context_class">web</property>
<mapping assembly="App_Code" />
</session-factory>
</hibernate-configuration>
Please help i am failing to publish my project to web for 3 days now :( Thanks