diff --git a/Bootstrap.Admin/App_Start/DBPublisher.cs b/Bootstrap.Admin/App_Start/DBPublisher.cs index ad118737..d4ee6bda 100644 --- a/Bootstrap.Admin/App_Start/DBPublisher.cs +++ b/Bootstrap.Admin/App_Start/DBPublisher.cs @@ -1,4 +1,5 @@ using Bootstrap.DataAccess; +using Longbow.Caching; using Longbow.ExceptionManagement; using Longbow.ExceptionManagement.Configuration; using System; @@ -21,6 +22,7 @@ namespace Bootstrap.Admin { if (publisherElement.Mode == PublisherMode.Off) return; ExceptionHelper.Log(ex, additionalInfo); + CacheManager.Clear(k => k == ExceptionHelper.RetrieveExceptionsDataKey); } } } \ No newline at end of file diff --git a/Bootstrap.DataAccess/ExceptionHelper.cs b/Bootstrap.DataAccess/ExceptionHelper.cs index 44389332..ccd803a6 100644 --- a/Bootstrap.DataAccess/ExceptionHelper.cs +++ b/Bootstrap.DataAccess/ExceptionHelper.cs @@ -14,7 +14,10 @@ namespace Bootstrap.DataAccess /// public static class ExceptionHelper { - internal const string RetrieveExceptionsDataKey = "ExceptionHelper-RetrieveExceptions"; + /// + /// + /// + public static readonly string RetrieveExceptionsDataKey = "ExceptionHelper-RetrieveExceptions"; /// /// /// @@ -32,7 +35,7 @@ namespace Bootstrap.DataAccess cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@AppDomainName", AppDomain.CurrentDomain.FriendlyName)); cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@ErrorPage", additionalInfo["ErrorPage"])); cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@UserID", DBAccess.ToDBValue(additionalInfo["UserId"]))); - cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@UserIp", additionalInfo["UserIp"])); + cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@UserIp", DBAccess.ToDBValue(additionalInfo["UserIp"]))); cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@ExceptionType", ex.GetType().FullName)); cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@Message", ex.Message)); cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@StackTrace", DBAccess.ToDBValue(ex.StackTrace), ParameterDirection.Input)); @@ -68,8 +71,8 @@ namespace Bootstrap.DataAccess Id = (int)reader[0], AppDomainName = (string)reader[1], ErrorPage = (string)reader[2], - UserId = (string)reader[3], - UserIp = (string)reader[4], + UserId = reader.IsDBNull(3) ? string.Empty : (string)reader[3], + UserIp = reader.IsDBNull(4) ? string.Empty : (string)reader[4], ExceptionType = (string)reader[5], Message = (string)reader[6], StackTrace = (string)reader[7], diff --git a/DatabaseScripts/Install.sql b/DatabaseScripts/Install.sql index dd7c4db3..b83ea8af 100644 --- a/DatabaseScripts/Install.sql +++ b/DatabaseScripts/Install.sql @@ -258,8 +258,8 @@ CREATE TABLE [dbo].[Exceptions]( [ID] [int] IDENTITY(1,1) NOT NULL, [AppDomainName] [varchar](50) NOT NULL, [ErrorPage] [varchar](50) NOT NULL, - [UserID] [varchar](50) NOT NULL, - [UserIp] [varchar](15) NOT NULL, + [UserID] [varchar](50) NULL, + [UserIp] [varchar](15) NULL, [ExceptionType] [nvarchar](max) NOT NULL, [Message] [nvarchar](max) NOT NULL, [StackTrace] [nvarchar](max) NULL,