0
SqlCacheDependencyAdmin.EnableNotifications(connString);
SqlCacheDependencyAdmin.EnableTableForNotifications(connString, tableName);
SqlCacheDependency sqlDenpendency = new SqlCacheDependency(entryName, tableName);
HttpRuntime.Cache.Insert(key,lstData,sqlDenpendency,DateTime.Now.AddMinutes(timeout), Cache.NoSlidingExpiration);

When I used SqlCacheDependency to save some data into HttpRuntime.Cache like this,there was a runtime error as following:

Current user uu163 have no permission . The transaction ended in the trigger. The batch has been aborted.

[SqlException (0x80131904): Current user uu163 have no permission . The transaction ended in the trigger. The batch has been aborted.] System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) +2442126 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) +5736904 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +628 System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +3731 System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite) +940 System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite) +272 System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +280 System.Web.Caching.SqlCacheDependencyAdmin.SetupNotifications(Int32 flags, String table, String connectionString) +752

How to solve this error?

Giulio Caccin
  • 2,962
  • 6
  • 36
  • 57
Joeries
  • 81
  • 4
  • 1
    Add permissions to user `uu163` ? – Koby Douek Aug 23 '17 at 12:33
  • You can try adding permissions to that user, but this is certainly a custom error message. You might want to try looking for whatever throws that error to see why it's throwing it. – Siyual Aug 23 '17 at 12:42
  • I've got the reason of this error that the user had no permission to create roles which SqlCacheDependencyAdmin.EnableNotifications need.Thanks! – Joeries Aug 24 '17 at 08:09

0 Answers0