Linq to SQL 文件上传到服务器后未实例化问题

9 篇文章 0 订阅
2 篇文章 0 订阅

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.



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值