Got a weird issue today with a LINQ to SQL dbml file.
It did work all right in local host but collapse after uploading to the web server.
It threw an Object reference not set to an instance of an object. error from the .dbml.designer.cs file.
The issue is caused by the connection string used by the file, as it exist in the local web.config file but not on the web server. To fix it, just copy the <add ....... /> tag of the connectionstr file to the web.config on the server.
My assumption is that the dbml file somehow replaced the old connectionstr with a new created one by accidentally operations. After upload the new dbml file to the server, it couldn't find the connectionstr anymore from the web.config file, so couldn't create an object of the linq to sql entity.
This also rises up a question. How was the original connectionstr added into the server side web.config file, as I don't remember I did this manually. Some many things need to be discovered.