Asp.net web api Breezejs SaveChanges error.detail未为OptimisticConcurrencyException定义

Asp.net web api Breezejs SaveChanges error.detail未为OptimisticConcurrencyException定义,asp.net-web-api,breeze,Asp.net Web Api,Breeze,如下图所示,在并发异常中,saveChanges fail函数在error obj中没有提供详细的属性 搜索后,发现我需要在web配置中将customerrors设置为off。但是在prod server或localhost中,没有可用的方法获取详细信息。 当我深入研究error prop时,我在internalexception的internalexception中发现了并发异常,但error obj的详细属性仍然没有定义 var reason = error.message;

如下图所示,在并发异常中,saveChanges fail函数在error obj中没有提供详细的属性

搜索后,发现我需要在web配置中将customerrors设置为off。但是在prod server或localhost中,没有可用的方法获取详细信息。 当我深入研究error prop时,我在internalexception的internalexception中发现了并发异常,但error obj的详细属性仍然没有定义

  var reason = error.message;
        var detail = error.detail;

        if (error.entityErrors) {
            reason = this.handleSaveValidationError(error);
        } else if (detail && detail.ExceptionType &&
            detail.ExceptionType.indexOf('OptimisticConcurrencyException') !== -1) {
            // Concurrency error 
            reason =
                "Another user, perhaps the server, " +
                "may have deleted one or all of the todos." +
                " You may have to restart the app.";
        } else {
            reason = "Failed to save changes: " + reason +
                " You may have to restart the app.";
        }
请让我知道我遗漏的要点

im使用mvc应用程序和webapi2以及vs2013


能否确保实体的必需属性都已设置,尤其是Id或任何外键字段

这听起来像是抛出了实体框架错误,应该在屏幕截图中的httpResponse对象中,但更好的解决方案是调试服务器并查看是什么导致了错误


你可以检查你的保存负载是否存在问题,或者在服务器上设置一个断点以进一步检查。

老实说,我是如何尝试在saveChanges的saveError方法中测试以下代码的。我尝试的只是在浏览器的不同选项卡中打开同一实体并同时删除这两个实体。第二次删除实际上会给我系统。在innerexception中存在并发异常的服务器。但是详细信息属性未定义

  var reason = error.message;
        var detail = error.detail;

        if (error.entityErrors) {
            reason = this.handleSaveValidationError(error);
        } else if (detail && detail.ExceptionType &&
            detail.ExceptionType.indexOf('OptimisticConcurrencyException') !== -1) {
            // Concurrency error 
            reason =
                "Another user, perhaps the server, " +
                "may have deleted one or all of the todos." +
                " You may have to restart the app.";
        } else {
            reason = "Failed to save changes: " + reason +
                " You may have to restart the app.";
        }
这是我在保存更改后从服务器得到的响应