I'm having some issues with my connection string. I've been testing a lot of different strings and approaches and now I'm stuck.
private static void InitializeSessionFactory()
{
_sessionFactory = Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2008
.ConnectionString(
@"Server=Data Source=.\SQLEXPRESS;DataBase=carDB.mdf;User ID=sa;Password=xxxSecretxxx;")
.ShowSql()
)
.Mappings(m =>
m.FluentMappings
.AddFromAssemblyOf<Car>())
.ExposeConfiguration(cfg => new SchemaExport(cfg).Create(true, false))
.BuildSessionFactory();
}
(I know I shouldn't be using 'sa' at all - why I've done so is solely because of lack of management software so I had to use the only account there were)
I am using a SQL Server Express database.
The exception I get is this:
An invalid or incomplete configuration was used while creating a SessionFactory.
Check PotentialReasons collection, and InnerException for more detail.
This is my inner exception
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)
Does anyone know how I should approach this? I've spent hours trying to get this to work.
.sdfextension), or Express (at least two files - one.mdf, another.ldf) - but not both at the same time! So which is it??