How to solve "Attempting to mount a database with auto-name for file ..." SQL error?

I have a local SQL .mdf database file that I use for an integration testing project. Everything works fine on the initial machine on which I created the project, database, etc., but when I try to run the project on another computer, I get the following:

System.Data.SqlClient.SqlException: A connection was successfully made to the server, but then an error occurred during the login process. (provider: shared memory provider, error: 0 - no process is on the other end of the channel.)

I believe that while I research this problem, I will also ask the community to find out if someone has already overcome this.

An exception occurs when I create a new data context. I am using LINQ-to-SQL.

m_TransLogDataContext = new TransLogDataContext ();

Let me know if additional information is needed. Thank.

+3
source share
2 answers

I am going to answer my question as I have a solution.

I relied on an auto-connect string that had the wrong "AttachDbFilename" property set to a location that was fine on the source computer, but which was not on the new machine.

I will have to dynamically build the connection string, since I want this to be done directly from the control source without the need for manual configuration.

Easy enough.

+3
source

This is because your application has more than one parameter in the database, try β€œFind All” in your solution by searching for the name your connection likes

" EnergyRetailSystemConnectionString"

+1

Source: https://habr.com/ru/post/1697453/


All Articles