nhibernate / fluent-nhibernate

Fluent NHibernate!
BSD 3-Clause "New" or "Revised" License
1.66k stars 686 forks source link

connectionstring not working in nhibernate.xml #616

Closed listentomyblues closed 1 year ago

listentomyblues commented 1 year ago

I encountered an issue: 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: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details. )

it seems that I cannot connect to my local database which is configured in my nhibernate.xml. the same connection string is working when using other forms of connection (ADO.net, EntityFrameWork). Am I missing something here?

here is my xml file:

<?xml version='1.0' encoding='utf-8'?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
    <session-factory>
        <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
        <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
        <property name="connection.connection_string">Server=(localdb)\mssqllocaldb;Database=my_database;Trusted_Connection=True;MultipleActiveResultSets=true</property>
        <property name="show_sql">true</property>
        <property name="dialect">NHibernate.Dialect.MsSql2008Dialect</property>
    </session-factory>
</hibernate-configuration>