【发布时间】:2014-07-02 11:50:13
【问题描述】:
我正在开发电子商务系统 (NopCommerce)。我使用的技术是 Asp.Net Mvc3 和 sql server 2008 下订单时抛出异常(不是每次,而是在数据库负载时)
将产品添加到订单后,我使用以下功能更新库存
_productService.AdjustInventory(sc.ProductVariant, true, sc.Quantity, sc.AttributesXml);
Error while placing order. Error 0: Error: An error occurred while updating the entries. See the inner exception for details.. Full exception: System.Data.Entity.Infrastructure.DbUpdateException: An error occurred while updating the entries. See the inner exception for details. ---> System.Data.UpdateException: An error occurred while updating the entries. See the inner exception for details. ---> System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
可能有很多客户在线或我正在更新 ProductVariant,这是一个漫长的过程(需要 10-12 分钟)。那时只抛出这个异常。
避免此异常的任何解决方案。
【问题讨论】:
-
是的,修复更新过程,使其不会运行 10-12 分钟
-
您的代码超时。在 NopCommerce 中,我没有看到任何事情需要这么长时间。您可能需要检查您的数据库、更新索引、统计信息等。
标签: asp.net-mvc entity-framework asp.net-mvc-3 sql-server-2008 nopcommerce