I am using sql server 2005
but having error message on _sessionFactory = configuration.BuildSessionFactory();
What is wrong and how can I correct it?
My Hibernate.cfg.xml
<property name="connection.driver_class">NHibernate.Connection.DriverConnectionProvider</property>
<property name="dialect">NHibernate.Dialect.MsSql2000Dialect</property>
<!--<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>-->
<property name="connection.connection_string">Server=localhost\SQLServer2005;database=NHibernate101;Integrated Security=True;</property>
<property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
<mapping assembly="Infrastructure"></mapping>
and my in my web.config
<connectionStrings>
<add name="ApplicationServices" connectionString="Server=localhost\SQLServer2005;database=NHibernate101;" providerName="NHibernate.Connection.DriverConnectionProvider"/>
</connectionStrings>
Error message is:
NHibernate.HibernateException was unhandled by user code Message=Could not create the driver from NHibernate.Connection.DriverConnectionProvider. Source=NHibernate StackTrace: at NHibernate.Connection.ConnectionProvider.ConfigureDriver(IDictionary
2 settings) at NHibernate.Connection.ConnectionProvider.Configure(IDictionary
2 settings) at NHibernate.Connection.ConnectionProviderFactory.NewConnectionProvider(IDictionary2 settings) at NHibernate.Cfg.SettingsFactory.BuildSettings(IDictionary
2 properties) at NHibernate.Cfg.Configuration.BuildSettings() at NHibernate.Cfg.Configuration.BuildSessionFactory() at Core.Domain.Repositories.NHibernateHelper.get_SessionFactory() in C:\Documents and Settings\nHibernate101\NHibernate101 Final\NHibernate101\Core\Domain\Repositories\NHibernateHelper.cs:line 22 at Core.Domain.Repositories.NHibernateHelper.OpenSession() in C:\Documents and Settings\nHibernate101\NHibernate101 Final\NHibernate101\Core\Domain\Repositories\NHibernateHelper.cs:line 30 at Core.Domain.Repositories.PostRepository.Core.IRepository.GetAll() in C:\Documents and Settings\nHibernate101\NHibernate101 Final\NHibernate101\Core\Domain\Repositories\PostRepository.cs:line 59 at NHibernate101.Controllers.PostsController.Index() in C:\Documents and Settings\nHibernate101\NHibernate101 Final\NHibernate101\NHibernate101\Controllers\PostsController.cs:line 22 at lambda_method(Closure , ControllerBase , Object[] ) at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary
2 parameters) at System.Web.Mvc.ControllerActionInvoker.<>c_DisplayClassd.b_a() at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func1 continuation) InnerException: System.InvalidCastException Message=Unable to cast object of type 'NHibernate.Connection.DriverConnectionProvider' to type 'NHibernate.Driver.IDriver'. Source=NHibernate StackTrace: at NHibernate.Connection.ConnectionProvider.ConfigureDriver(IDictionary
2 settings) InnerException: