我使用的是企业库5,异常和日志记录块 当有例外情况时,它会像这样抓住:
bool rethrow = DataAccessExceptionHandler.HandleException(ref ex);
if (rethrow)
{
throw ex;
}
return null;
并且日志文件在TimeStamp中显示错误的日期时间(应该是07/13/2013 07:23:42) 怎么解决这个?
日志文件:
----------------------------------------时间戳:2013年7月13日上午12:23:42
消息:HandlingInstanceID:4e5174e2-a2e1-4d4e-8d45-f9a7fa447a87 类型' System.Data.SqlClient.SqlException'的异常发生了 被抓住了。 -------------------------------------------------- -------------------------------- 07/13/2013 07:23:42类型:System.Data.SqlClient。 SQLEXCEPTION, System.Data,Version = 4.0.0.0,Culture = neutral, PublicKeyToken = b77a5c561934e089消息:用户'登录失败。 来源:.Net SqlClient数据提供程序帮助链接:错误: System.Data.SqlClient.SqlErrorCollection ClientConnectionId: fa9edc34-dc0a-420f-bde2-19b8ac071e8c类别:14 LineNumber:65536 编号:18456过程:服务器:。\ SQLSERVER2008状态:1 ErrorCode:-2146232060数据: System.Collections.ListDictionaryInternal TargetSite:Void OnError(System.Data.SqlClient.SqlException,Boolean, System.Action
1[System.Action]) HResult : -2146232060 Stack Trace :
1 wrapCloseInAction)at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj,Boolean callerHasConnectionLock,Boolean asyncClose)at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler,SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler,TdsParserStateObject stateObj,布尔& dataReady)at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler,SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler,TdsParserStateObject stateObj)at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(布尔 enlistOK)at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo,String newPassword,SecureString newSecurePassword, Boolean ignoreSniOpenTimeout,TimeoutTimer timeout,Boolean withFailover)at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo,String newPassword,SecureString newSecurePassword, Boolean redirectedUserInstance,SqlConnectionString connectionOptions, SqlCredential凭据,TimeoutTimer超时)at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout,SqlConnectionString connectionOptions,SqlCredential credential,String newPassword,SecureString newSecurePassword, Boolean redirectedUserInstance)at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity,SqlConnectionString connectionOptions,SqlCredential 凭证,Object providerInfo,String newPassword,SecureString newSecurePassword,Boolean redirectedUserInstance,SqlConnectionString userConnectionOptions)at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options,DbConnectionPoolKey poolKey,Object poolGroupProviderInfo, DbConnectionPool池,DbConnection owningConnection, DbConnectionOptions userOptions)at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(类DBConnectionPool pool,DbConnectionOptions选项,DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnectionOptions userOptions)at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnectionOptions userOptions)at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(的DbConnection owningObject,UInt32 waitForMultipleObjectsTimeout,Boolean allowCreate,Boolean onlyOneCheckConnection,DbConnectionOptions userOptions,DbConnectionInternal&连接) System.Data.ProviderBase.DbConnectionPool.TryGetConnection(的DbConnection owningObject,TaskCompletionSource
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource
1重试,DbConnectionOptions userOptions,DbConnectionInternal&连接) System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(的DbConnection outerConnection,DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions) at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource
1 重试)在System.Data.SqlClient.SqlConnection.Open()处 Microsoft.Practices.EnterpriseLibrary.Data.Database.GetNewOpenConnection() 在 E:\构建\ EntLib \最新\来源\块\ DATA \ SRC \数据\ Database.cs:行 1176年 Microsoft.Practices.EnterpriseLibrary.Data.Database.GetWrappedConnection() 在 E:\构建\ EntLib \最新\来源\块\ DATA \ SRC \数据\ Database.cs:行 1200点 Microsoft.Practices.EnterpriseLibrary.Data.Database.GetOpenConnection() 在 E:\构建\ EntLib \最新\来源\块\ DATA \ SRC \数据\ Database.cs:行 1191年 Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteReader(的DbCommand 命令)in E:\构建\ EntLib \最新\来源\块\ DATA \ SRC \数据\ Database.cs:行 843在 GTMP.MiddleTier.DAL.PointsTransactionDAL.GetLastTransaction()in d:\项目\ VS2010 \ GoTronikMemberPoint \ GTMP.MiddleTier.DAL \ PointsTransactionDAL.cs:行 86其他信息:
MachineName:ALPHACOM TimeStamp:7/13/2013 12:23:42 AM FullName: Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version = 5.0.414.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35 AppDomainName:GTMP.PresentationTier.Con.vshost.exe ThreadIdentity: WindowsIdentity:ALPHACOM \ sky
类别:ExceptionLog
优先级:0
EventId:100
严重性:错误
标题:企业库异常处理
机器:ALPHACOM
App Domain:GTMP.PresentationTier.Con.vshost.exe
ProcessId:752
流程名称: d:\项目\ VS2010 \ GoTronikMemberPoint \ GTMP.PresentationTier.Con \ BIN \调试\ GTMP.PresentationTier.Con.vshost.exe
主题名称:
Win32 ThreadId:7096
扩展属性:HelpLink.ProdName - Microsoft SQL Server HelpLink.EvtSrc - MSSQLServer HelpLink.EvtID - 18456 HelpLink.BaseHelpUrl - http://go.microsoft.com/fwlink HelpLink.LinkId - 20476
感谢。