Quantcast
Channel: Security
Viewing all articles
Browse latest Browse all 4737

Spurious exceptions from universal providers when application pool starts up with IDbCommandInterceptor

$
0
0

Don't know if this is the right place to post this but i'm having a problem with asp.net universal providers 2.0.0 Entity Framework IDbCommandInterceptor.  When the application pool spins up and i attempt to login the interecptionContext catches this error. Is this a bug or is this intended behavior? 

I am using all of the universal providers in my application.

I am attempting to attach an error logger to the entity framework system FYI.  

Right now my only recourse is to just attach giant if blocks. like so. 

if (interceptionContext.Exception.Message.StartsWith("The operation failed because an index or statistics with name 'IDX_UserName' already exists on table 'Users'.") ||                            interceptionContext.Exception.Message.StartsWith("There is already an object named 'Applications' in the database.")                        )                        {                            return;                        }

Date Occured: 2014-04-21 08:45:17.2302

Error Level: ERROR

Message:

 Error Processing SQL Query ApproximateQuery:

 create table [dbo].[Applications] (

    [ApplicationId] [uniqueidentifier] not null,

    [ApplicationName] [nvarchar](235) not null,

    [Description] [nvarchar](256) null,

    primary key ([ApplicationId])

);

 Database: TEST-SQL\TESTSQL1:mydatabase

Stack Trace: ExecutionContext.RunInternal => Task.Execute => <>c__DisplayClass4`1.<LogCommand>b__0

 

Exception: System.Data.SqlClient.SqlException (0x80131904): There is already an object named 'Applications' in the database.

   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`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, Boolean& dataReady)

   at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)

   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite)

   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()

   at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)

   at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.NonQuery(DbCommand command, DbCommandInterceptionContext interceptionContext)

   at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)

   at System.Data.Entity.Core.Objects.ObjectContext.<>c__DisplayClass59.<ExecuteStoreCommand>b__57()

   at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)

   at System.Web.Providers.ModelHelper.ExecuteSql(DbContext db, String sql) ClientConnectionId:27c020ac-00a3-44e7-ace0-ab1b216db68e

Date Occured: 2014-04-21 08:45:17.2302

Error Level: ERROR

Message:

 Error Processing SQL Query ApproximateQuery:

 CREATE NONCLUSTERED INDEX IDX_UserName ON Users (UserName);

 Database: TEST-SQL\TESTSQL1:mydatabase

Stack Trace: ExecutionContext.RunInternal => Task.Execute => <>c__DisplayClass4`1.<LogCommand>b__0

 

Exception: System.Data.SqlClient.SqlException (0x80131904): The operation failed because an index or statistics with name 'IDX_UserName' already exists on table 'Users'.

   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`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, Boolean& dataReady)

   at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)

   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite)

   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()

   at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)

   at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.NonQuery(DbCommand command, DbCommandInterceptionContext interceptionContext)

   at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)

   at System.Data.Entity.Core.Objects.ObjectContext.<>c__DisplayClass59.<ExecuteStoreCommand>b__57()

   at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)

   at System.Web.Providers.ModelHelper.ExecuteSql(DbContext db, String sql) ClientConnectionId:27c020ac-00a3-44e7-ace0-ab1b216db68e


Viewing all articles
Browse latest Browse all 4737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>