I use to run site with one database, but now we expanded with new features on 2nd database. Im suddenly getting exceptions like this, im not sure if its related to connection strings, can someone more experienced in this give me a clue.
NOTE: Users can connect normaly, but after session expire im getting this in logs:
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: 52 - Unable to locate a Local Database Runtime installation. Verify that SQL Server Express is properly installed and that the Local Database Runtime feature is enabled.)
Inner exception :
System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified
I run site with 2 connection strings, like below:
<connectionStrings>
<add name="db_entity1" connectionString="metadata=res://*/Models.AliModel.csdl|res://*/Models.AliModel.ssdl|res://*/Models.AliModel.msl;provider=System.Data.SqlClient;provider connection string="data source=192.168.200.6;initial catalog=dbname;user id=dbusername;password=password;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
<add name="db_ProductionEntities" connectionString="metadata=res://*/Models.Model.csdl|res://*/Models.Model.ssdl|res://*/Models.Model.msl;provider=System.Data.SqlClient;provider connection string="data source=192.168.200.2;initial catalog=maindatabasename;user id=databaseusername;password=password;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
db_ProductionEntities Is my default connection to which users connect to website (this is where usernames are and emails). 2nd connection is just for new features.
Remove the defaultConnectionfactory setting
User contributions licensed under CC BY-SA 3.0