未将对象引用设置为对象数据上下文的实例
I am trying to publish asp.net mvc site on remote server I am getting the error as shown in figure. Any idea
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
I am trying to publish asp.net mvc site on remote server I am getting the error as shown in figure. Any idea
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
我解决了这个问题,问题是设计器文件连接名称与 web.config 的名称不同。一旦两个名称相同,它就开始正常运行。
I solved it the problem was that in the designer file connection name was different then that of web.config. Once both name are same it started running fine.
只要有机会发布更大尺寸的图像,堆栈跟踪就很难阅读。
作为猜测,看起来异常是在代码的数据库上下文区域中引发的 - 可能是实体框架?
首先,看一下
Models.EvloetDatabaseContext
构造函数 - 其中是否有任何内容可能导致空引用异常?您可以在该方法中放置一些
Trace.WriteLine
调用,并使用诸如 DebugView 查看发送了多少条消息。我在调试客户端服务器上的问题时经常使用他。Any chance you could post a larger scale of the image, the stack trace is very tricky to read.
As a guess, it looks like the exception is being raised in the database context area of code - possibly Entity Framework??
First, have a look at the
Models.EvloetDatabaseContext
constructor - is there anything in there that might cause the null reference exception?You could put some
Trace.WriteLine
calls in that method and use a tool such as DebugView to see how many of those messages are being sent out. I use his often when debugging issues on a client's server.