的SqlDependency缓存不工作 [英] SQLDependency Caching not working

查看:329
本文介绍了的SqlDependency缓存不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的 ASP.NET 应用程序中使用的SqlDependency缓存与查询通知。
我跟着这些步骤来设置的SqlDependency缓存。我是能够建立分贝成功。
然而,当我跑我的应用我收到以下错误。

I am trying to use SQLDependency Caching with Query Notifications in my ASP.NET application. I followed these steps to set up SQLDependency Caching.I was able to set up the db successfully. However,when I run my application I am getting the following error.

Cannot find the specified user 'owner'.
Cannot find the queue
SqlQueryNotificationService-6c3ae823-a678-4ed2-8b97-561b5f2561ee', 
because it does not exist or you do not have permission.
Invalid object name
SqlQueryNotificationService-6c3ae823-a678-4ed2-8b97-561b5f2561ee'.

code 的Global.asax

void Application_Start(object sender, EventArgs e)
    {
        // Code that runs on application startup
        System.Data.SqlClient.SqlDependency.Start(ConfigurationManager.ConnectionStrings["McdConn"].ToString());

    }

我想谷歌的解决方案,但我不能得到任何帮助。

I tried to Google the solution but I could not get any help.

谁能帮我?

我缺少的东西吗?

推荐答案

要么你可以给用户系统管理员权利
OR

Either you can give the User sysadmin rights OR

修改权限, DBO 模式。

为了创建一个过程,函数,架构范围内的对象等,需要在目标模式至少 ALTER 许可。这里是TSQL语法,

In order to create a procedure, a function, schema scoped objects etc.., you need at least ALTER permission on the target schema. Here is the TSQL syntax,

grant alter on schema :: schema_name to  user_name

用户也应具有对通知服务,队列的权限。
要授予权限的用户约翰在服务队列是:

GRANT SEND on service::SqlQueryNotificationService to John
GRAND RECEIVE on SqlQueryNotificationService_DefaultQueue to John

另外,用户需要允许订阅通知(这是由你我猜已经完成),要做到这一点:

Also the user needs permission to subscribe to notification.( This is done already by you I guess) To do this use:

GRANT SUBSCRIBE QUERY NOTIFICATIONS TO John

最后一点到目前为止,我可以猜测,以帮助是,如果你有设置的SqlDependency 上的命令,然后确保你的服务器上执行it.Query订阅仅在命令执行发生。

One last point so far i can guess to help is that in case you have setup SqlDependency on a command, then make sure you execute it.Query subscriptions on the server happen only on command execution.

SqlDataReader reader = command.ExecuteReader();

帖子可能证明更有帮助

这篇关于的SqlDependency缓存不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆