开发者

Web.config and dbml connection string

I have a silverlight web project using LinqToSql for database connection. I developed it on my local SQL box using the local name of database. Now, when i deploy it on my production web server, do i have to recompile the code again to change the connection string for production db or just changing the db name in web.config will work.

Also, do i have to give specific username/password in the web.config file or dbml开发者_StackOverflow中文版 will pick that from IIS AppPool.


When you create your app in .net 4, you will get 3 web.config. the live connection string should be put into the web.live.config.

just search for it for guidelines.


You dont have to recompile, but you have to point your linq to sql default constructor to use the connection string from web.conf

in web.conf use the connection sring with user name and password for the new server and you will not have to set password or username any where else.

please refer to this article for more help

http://aspilham.blogspot.com/2011/01/how-do-i-set-connection-string-in-linq.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜