1

当出现异常时,我正在使用企业库 5、异常和日志记录块,它的捕获如下:

bool rethrow = DataAccessExceptionHandler.HandleException(ref ex);
if (rethrow)
{
   throw ex;
}
return null;

并且日志文件在时间戳中显示错误的日期时间(应该是 07/13/2013 07:23:42)如何解决这个问题?

日志文件:

---------------------------------------- 时间戳:7/13/2013 12:23 :42 上午

消息:HandlingInstanceID:4e5174e2-a2e1-4d4e-8d45-f9a7fa447a87 发生并捕获了“System.Data.SqlClient.SqlException”类型的异常。-------------------------------------------------- -------------------------------- 2013 年 7 月 13 日 07:23:42 类型:System.Data.SqlClient。 SqlException,System.Data,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089 消息:用户“sa”登录失败。来源:.Net SqlClient 数据提供程序帮助链接:错误:System.Data.SqlClient.SqlErrorCollection ClientConnectionId:fa9edc34-dc0a-420f-bde2-19b8ac071e8c 类:14 行号:65536 编号:18456 过程:服务器:.\SQLSERVER2008 状态:1 错误代码:-2146232060 数据:System.Collections.ListDictionaryInternal TargetSite:无效 OnError(System.Data.SqlClient.SqlException,布尔,系统。1[System.Action]) HResult : -2146232060 Stack Trace :
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action
1 wrapCloseInAction) 在 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) 在 System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject state&Obj, Boolean dataReady) 在 System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) 在 System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(RunBehavior runBehavior,SqlCommand cmdHandler,SqlDataReader dataStream,BulkCopySimpleResultSet bulkCopyHandler,TdsParserStateObject stateObj) 在 System.Data.SqlClient.SqlInternalConnectionTds .AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout,TimeoutTimer 超时,Boolean withFailover) 在 System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) 在 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer超时,SqlConnectionString connectionOptions,SqlCredential credential,String newPassword,SecureString newSecurePassword,Boolean redirectedUserInstance)在 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity 标识,SqlConnectionString connectionOptions,SqlCredential credential,对象 providerInfo,String newPassword,SecureString newSecurePassword,Boolean redirectedUserInstance,SqlConnectionString userConnectionOptions) 在 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions 选项,DbConnectionPoolKey poolKey,对象 poolGroupProviderInfo,DbConnectionPool 池,DbConnection owningConnection,DbConnectionOptions userOptions) 在 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool 池,DbConnectionOptions 选项,DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) 在 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnectionOptions userOptions) 在 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnectionOptions userOptions) 在 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout,布尔允许创建,Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource1 次重试,DbConnectionOptions userOptions,DbConnectionInternal& 连接)在 System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions) at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource1 次重试)在 e:\Builds\EntLib\Latest\Source\Blocks\Data\Src\Data\Database 中 Microsoft.Practices.EnterpriseLibrary.Data.Database.GetNewOpenConnection() 的 System.Data.SqlClient.SqlConnection.Open() .cs:第 1176 行 Microsoft.Practices.EnterpriseLibrary.Data.Database.GetWrappedConnection() 在 e:\Builds\EntLib\Latest\Source\Blocks\Data\Src\Data\Database.cs:第 1200 行在 Microsoft.Practices。 EnterpriseLibrary.Data.Database.GetOpenConnection() 在 e:\Builds\EntLib\Latest\Source\Blocks\Data\Src\Data\Database.cs:Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteReader 的第 1191 行(DbCommand 命令) 在 e:\Builds\EntLib\Latest\Source\Blocks\Data\Src\Data\Database.cs:第 843 行 GTMP.MiddleTier.DAL.PointsTransactionDAL.GetLastTransaction() 在 D:\Projects\VS2010\GoTronikMemberPoint\GTMP .中间层。DAL\PointsTransactionDAL.cs:第 86 行

附加信息:

机器名称:ALPHACOM 时间戳:2013 年 7 月 13 日上午 12:23:42 全名:Microsoft.Practices.EnterpriseLibrary.ExceptionHandling,版本=5.0.414.0,文化=中性,PublicKeyToken=31bf3856ad364e35 AppDomainName:GTMP.PresentationTier.Con.vshost.exe ThreadIdentity:WindowsIdentity:ALPHACOM\sky

类别:异常日志

优先级:0

事件编号:100

严重性:错误

标题:企业库异常处理

机器:阿尔法康

应用程序域:GTMP.PresentationTier.Con.vshost.exe

进程 ID:752

进程名称:D:\Projects\VS2010\GoTronikMemberPoint\GTMP.PresentationTier.Con\bin\Debug\GTMP.PresentationTier.Con.vshost.exe

线程名称:

Win32 线程 ID:7096

扩展属性:HelpLink.ProdName - Microsoft SQL Server HelpLink.EvtSrc - MSSQLServer HelpLink.EvtID - 18456 HelpLink.BaseHelpUrl - http://go.microsoft.com/fwlink HelpLink.LinkId - 20476


谢谢。

4

0 回答 0