我在分布式数据库服务器上运行实体框架。我偶尔会遇到连接超时异常,一天只发生两到三次。实际的.Net例外是:
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.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler,
SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior
runBehavior,String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior
runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior
runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String
methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at System.Data.Mapping.Update.Internal.DynamicUpdateCommand.Execute(UpdateTranslator translator,
EntityConnection connection, Dictionary`2 identifierValues, List`1 generatedValues)
at System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager,
IEntityAdapter adapter)
--- End of inner exception stack trace ---
at System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager,
IEntityAdapter adapter)
at System.Data.Objects.ObjectContext.SaveChanges(SaveOptions options)
at INW.BusinessLogicLayer.DataAccessLayer.FinishOrder(OrderHandlerRequest req, Guid userId)
at INW.BusinessLogicLayer.Objects.Order.OrderHandler.FinishOrder(OrderHandlerRequest req,
MembershipUser loggedinUser)
at INW.BusinessLogicLayer.Objects.PaymentGateway.PGHelper.ProcessRequest(String requestStr,
UserControl control, MembershipUser loggedInUser)
at INW.WebService.Insolvency.UpdatePaymentAuthorisationResultRequest(String
PaymentAuthorisationResult)
我的连接字符串是:
<add name="InsolvencyEntities"
connectionString="metadata=res://*/InsolvencyDB.csdl|res://*/InsolvencyDB.ssdl|res://*/
InsolvencyDB.msl;provider=System.Data.SqlClient;provider connection string="Data
Source=*.net.au;Failover Partner=*.net.au;Initial
Catalog=INWDAP;Trusted_Connection=True;MultipleActiveResultSets=True""
providerName="System.Data.EntityClient" />
我注意到在SQL日志
中发生了一些错误日期20/10/2014 4:51:55 PM 记录SQL Server(当前 - 2014年10月21日下午4:15:00)
来源登录
信息 用户'abc \ xyz $'登录失败。原因:无法打开显式指定的数据库。 [客户:113.192.23.72]
我不知道为什么会发生超时但偶尔会发生。谁能帮我这个 ?