frosty1
asked on
nhibernate sql Express connection issue - error: 26 - Error Locating Server/Instance Specified
I can connect fine with normal ado.net. However i get the following error when i tried to connect nHibernate.
## hibernate.cfg.xml
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-conf iguration- 2.2">
<session-factory>
<property name="dialect">NHibernate. Dialect.Ms Sql2005Dia lect</prop erty>
<property name="connection.provider" >NHibernat e.Connecti on.DriverC onnectionP rovider</p roperty>
<property name="connection.driver_cl ass">NHibe rnate.Driv er.SqlClie ntDriver</ property>
<property name="connection.connectio n_string"> Server=xxx xx\SQLEXPR ESS; Database=xxxxx; User ID=xxxxx; Password=xxxxx; Trusted_Connection=True</p roperty>
<property name="proxyfactory.factory _class">NH ibernate.B yteCode.Ca stle.Proxy FactoryFac tory, NHibernate.ByteCode.Castle </property >
<property name="show_sql">true</prop erty>
</session-factory>
</hibernate-configuration>
## Server error
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
## Full stack
[SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)]
System.Data.SqlClient.SqlI nternalCon nection.On Error(SqlE xception exception, Boolean breakConnection) +4845255
System.Data.SqlClient.TdsP arser.Thro wException AndWarning (TdsParser StateObjec t stateObj) +194
System.Data.SqlClient.TdsP arser.Conn ect(Server Info serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) +4858557
System.Data.SqlClient.SqlI nternalCon nectionTds .AttemptOn eLogin(Ser verInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +90
System.Data.SqlClient.SqlI nternalCon nectionTds .LoginNoFa ilover(Str ing host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +342
System.Data.SqlClient.SqlI nternalCon nectionTds .OpenLogin Enlist(Sql Connection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +221
System.Data.SqlClient.SqlI nternalCon nectionTds ..ctor(DbC onnectionP oolIdentit y identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +189
System.Data.SqlClient.SqlC onnectionF actory.Cre ateConnect ion(DbConn ectionOpti ons options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +185
System.Data.ProviderBase.D bConnectio nFactory.C reatePoole dConnectio n(DbConnec tion owningConnection, DbConnectionPool pool, DbConnectionOptions options) +31
System.Data.ProviderBase.D bConnectio nPool.Crea teObject(D bConnectio n owningObject) +433
System.Data.ProviderBase.D bConnectio nPool.User CreateRequ est(DbConn ection owningObject) +66
System.Data.ProviderBase.D bConnectio nPool.GetC onnection( DbConnecti on owningObject) +499
System.Data.ProviderBase.D bConnectio nFactory.G etConnecti on(DbConne ction owningConnection) +65
System.Data.ProviderBase.D bConnectio nClosed.Op enConnecti on(DbConne ction outerConnection, DbConnectionFactory connectionFactory) +117
System.Data.SqlClient.SqlC onnection. Open() +122
NHibernate.Connection.Driv erConnecti onProvider .GetConnec tion() +102
NHibernate.Tool.hbm2ddl.Su ppliedConn ectionProv iderConnec tionHelper .Prepare() +15
NHibernate.Tool.hbm2ddl.Sc hemaMetada taUpdater. GetReserve dWords(Dia lect dialect, IConnectionHelper connectionHelper) +65
NHibernate.Tool.hbm2ddl.Sc hemaMetada taUpdater. Update(ISe ssionFacto ry sessionFactory) +80
NHibernate.Impl.SessionFac toryImpl.. ctor(Confi guration cfg, IMapping mapping, Settings settings, EventListeners listeners) +599
NHibernate.Cfg.Configurati on.BuildSe ssionFacto ry() +87
XXX.Domain.Repositories.NH ibernateHe lper.get_S essionFact ory() in D:\dev\MyProject\XXX\XXX.D omain\Repo sitories\N HibernateH elper.cs:2 3
XXX.Domain.Repositories.NH ibernateHe lper.OpenS ession() in D:\dev\MyProject\XXX\XXX.D omain\Repo sitories\N HibernateH elper.cs:3 1
XXX.Domain.Repositories.En tryReposit ory.GetCou ntByGmapId (Int32 gmapId) in D:\dev\MyProject\XXX\XXX.D omain\Repo sitories\E ntryReposi tory.cs:15 2
XXX.Controls.Activity.Bind Repeater(I nt32 id) in D:\dev\MyProject\XXX\XXX.C ontrols\Ac tivity.asc x.cs:58
XXX.Controls.Activity.Drop DownListMa ps_Selecte dIndexChan ged(Object sender, EventArgs e) in D:\dev\MyProject\XXX\XXX.C ontrols\Ac tivity.asc x.cs:75
System.Web.UI.WebControls. ListContro l.OnSelect edIndexCha nged(Event Args e) +111
System.Web.UI.WebControls. DropDownLi st.RaisePo stDataChan gedEvent() +134
System.Web.UI.WebControls. DropDownLi st.System. Web.UI.IPo stBackData Handler.Ra isePostDat aChangedEv ent() +10
System.Web.UI.Page.RaiseCh angedEvent s() +165
System.Web.UI.Page.Process RequestMai n(Boolean includeStagesBeforeAsyncPo int, Boolean includeStagesAfterAsyncPoi nt) +1485
## hibernate.cfg.xml
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-conf
<session-factory>
<property name="dialect">NHibernate.
<property name="connection.provider"
<property name="connection.driver_cl
<property name="connection.connectio
<property name="proxyfactory.factory
<property name="show_sql">true</prop
</session-factory>
</hibernate-configuration>
## Server error
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
## Full stack
[SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)]
System.Data.SqlClient.SqlI
System.Data.SqlClient.TdsP
System.Data.SqlClient.TdsP
System.Data.SqlClient.SqlI
System.Data.SqlClient.SqlI
System.Data.SqlClient.SqlI
System.Data.SqlClient.SqlI
System.Data.SqlClient.SqlC
System.Data.ProviderBase.D
System.Data.ProviderBase.D
System.Data.ProviderBase.D
System.Data.ProviderBase.D
System.Data.ProviderBase.D
System.Data.ProviderBase.D
System.Data.SqlClient.SqlC
NHibernate.Connection.Driv
NHibernate.Tool.hbm2ddl.Su
NHibernate.Tool.hbm2ddl.Sc
NHibernate.Tool.hbm2ddl.Sc
NHibernate.Impl.SessionFac
NHibernate.Cfg.Configurati
XXX.Domain.Repositories.NH
XXX.Domain.Repositories.NH
XXX.Domain.Repositories.En
XXX.Controls.Activity.Bind
XXX.Controls.Activity.Drop
System.Web.UI.WebControls.
System.Web.UI.WebControls.
System.Web.UI.WebControls.
System.Web.UI.Page.RaiseCh
System.Web.UI.Page.Process
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.