DbContext.SaveChanges() 上的 EF 4.1 ComException
我正在使用 EF 4.1。每当执行 DbContext 操作(如 SaveChanges())期间发生错误时,我都会收到一条相当神秘的错误消息:System.Exception._ComPlusExceptionCode -532462766。显然这对于找出问题所在并没有多大帮助。在 EF 上下文中快速 Google 搜索 ComPlusException 没有返回任何有意义的结果。
如果我收到此错误消息的原因以及可以采取哪些措施以获得更具描述性的错误反馈,我们将不胜感激。
谢谢!!
代码:
public void InsertTarget(Target target)
{
try
{
_tgrContext.Targets.Add(target);
_tgrContext.SaveChanges();
}
catch (Exception)
{
throw;
}
}
I'm using EF 4.1. Whenever an error occurs during the execution of a DbContext operation like SaveChanges() I consistently receive a rather cryptic error message: System.Exception._ComPlusExceptionCode -532462766. Obviously this is not very helpful for finding out what went wrong. A quick Google search for ComPlusException in context with EF returned no meaningful results.
Any ideas why I receive this error message and what can be done in order to get a more descriptive error feedback would be much appreciated.
Thanks!!
Code:
public void InsertTarget(Target target)
{
try
{
_tgrContext.Targets.Add(target);
_tgrContext.SaveChanges();
}
catch (Exception)
{
throw;
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在这里找到问题的答案:
complusexceptions in net< /a>
简而言之:在 VS 代码编辑器中单击红色错误引号时,Visual Studio 将 complusException 代码解码为实际的错误消息。我很少使用这个视觉指示器,所以我想我很容易错过它。
Found the answer to the problem here:
complusexceptions in net
In short: Visual Studio decodes the complusexception code into the actual error message on click at the red error quation mark in the VS code editor. I hardly ever use this visual indicatior, so I guess it was easy to miss for me.