Recently, I am using LINQ as a site. The project environment is vs2008 + sqlserver2005. the local database uses sqlexpress of vs2005. Everything works normally. After that, I will release it to the server, the database and login name are configured normally. After you change the database connection string and run the site, the following error occurs:
I checked the reason for the day on the internet, basically it is said that the remote login or firewall should be enabled with exceptions. Finally, I discovered that it was the default database connection string used when I created datacontext.
Base (Global: Montclair. Models. properties. settings. Default. montclairconnectionstring, mappingsource)
The database connection string is the default connection string generated when you drag the database table to the dbml file from the server resource manager. Therefore, when you create a connection with the default datacontext () without parameters, the above error occurs. After you create a parameter with a connection string, the problem is solved.
It seems that the default method cannot be used in the future.
Remind yourself of similar problems in the future and how to find the cause of the problem.