设置订阅查询通知时出现问题
我目前正在为我们的网站实现缓存机制。 我想使用 SQL 缓存依赖功能。 我正在管理工作室中运行以下命令,但它不起作用。
GRANT SUBSCRIBE QUERY NOTIFICATIONS TO "my_server_name\ASPNET"
我收到的错误是:
Cannot find the user 'my_server_name\ASPNET', because it does not exist or you do not have permission.
我尝试使用特定数据库的管理员登录,我正在为计算机管理员设置通知、sa 和 Windows 身份验证。 还尝试以管理员身份运行管理工作室,但仍然不高兴。 有人可以指出我正确的方向吗? 谢谢你!
I'm currently implementing a cache mechanisem for our site.
I want to use the SQL Cache dependancy feature.
I am running the following command in management studio and it's not working.
GRANT SUBSCRIBE QUERY NOTIFICATIONS TO "my_server_name\ASPNET"
The error I'm getting is:
Cannot find the user 'my_server_name\ASPNET', because it does not exist or you do not have permission.
I tried signing in with the admin of the specific database I'm setting the notification for, sa, and windows authentication with the machine administrator.
Also tried running management studio as administrator and still not joy.
Can someone please point me in the right direction.
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,您似乎正在尝试向运行该网站的帐户授予权限。在 IIS 6 和 IIS7 中,这些由应用程序池上设置的帐户控制。该帐户曾经是
ASPNET
,但不再是默认帐户。相反,默认值(我相信从 .NET 2.0 开始)是 NETWORK SERVICE。但是,如果您使用 IIS 7,情况又发生了变化。默认情况下,在 IIS7 中,它使用称为“ApplicationPoolIdentity”的东西,这是为每个站点创建的自己的特殊凭据。如果 SQL Server 与 Web 服务器位于不同的计算机上,您将遇到另一个问题,即凭据都是计算机本地的。我的建议是根据您的设置执行以下操作:
两台服务器都位于域中,并且您想要使用可信连接:
GRANT SUBSCRIBE QUERY NOTIFICATIONS TO "domain name\MyIISAccount"
还可能存在与以下内容相关的其他 Kerberos 问题:事实上,域中的两台服务器都可能需要创建 SPN(服务主体名称)。
两台服务器都不在域中(即,两台服务器都是成员服务器),并且您想要使用可信连接:使用
GRANT SUBSCRIBE QUERY NOTIFICATIONS TO 'SQLServerMachineName\AccountUsedBySite'
您希望使用 SQL 帐户而不是受信任的连接:
GRANT SUBSCRIBE QUERY NOTIFICATIONS TO 'SQLUserAccountUsedBySite'
IIS 和 SQL Server 都在同一台计算机上,并且您希望使用可信连接
GRANT SUBSCRIBE QUERY NOTIFICATIONS TO 'SQLServerMachineName\MyIISAccount'
First, it appears you are attempting to grant permissions to the account under which the site is running. In IIS 6 and IIS7 these are control by the account set on the Application Pool. That account used to be
ASPNET
but no longer by default. Instead, the default (starting with .NET 2.0 I believe) isNETWORK SERVICE
. However, if you are using IIS 7, that has changed yet again. By default in IIS7 it uses something called the "ApplicationPoolIdentity" which is its own special credential created for each site. If SQL Server is on a different machine than the web server, you will run into another problem which is the credentials are all local to the machine.My recommendation would be to do the following depending on your setup:
Both servers are on a domain and you want to use trusted connections:
GRANT SUBSCRIBE QUERY NOTIFICATIONS TO "domain name\MyIISAccount"
There may also be other Kerberos issues related to the fact that both servers on the domain and that might require creating a SPN (Service Principal Name).
Neither server is on a domain (i.e., both are member servers) and you want to use trusted connections:
GRANT SUBSCRIBE QUERY NOTIFICATIONS TO 'SQLServerMachineName\AccountUsedBySite'
You want to use SQL accounts instead of a trusted connection:
GRANT SUBSCRIBE QUERY NOTIFICATIONS TO 'SQLUserAccountUsedBySite'
Both IIS and SQL Server are on the same machine and you want to use trusted connections
GRANT SUBSCRIBE QUERY NOTIFICATIONS TO 'SQLServerMachineName\MyIISAccount'
试试这个:
将订阅查询通知授予 [my_server_name\ASPNET]
Try this:
GRANT SUBSCRIBE QUERY NOTIFICATIONS TO [my_server_name\ASPNET]