+2  A: 

Your worker process identity needs to be changed to either a domain user OR a user with a matching username/password on both the web and database servers. The SQL Server would also need Windows authentication (or Mixed authentication) enabled.

Under IIS 5 (Windows XP/2000), you need to modify the ASP.NET Process Identity in the machine.config file.

Under IIS 6 / 7 (Windows Vista/7/2003/2008/R2) you should just be able to modify the Application Pool identity. If this doesn't work, enable <identity impersonate="true" /> in your web.config.

Richard Szalay
+1  A: 

SqlDependencyCache uses SqlDependency and SqlDependency deploys at runtime a set of services, queues and stored procedures in your database as part of its infrastructure. You can read this article on more details what really happens The Mysterious Notification.

When you create your site map provider, you provide a connection string. This connection string specifies either a SQL login and password, or it specifies that SSPI (or Trusted, or Integrated) Authentication should be used. When a user and password are provided then this user is used to log in into your application database (the ASP database). When SSPI is used then the conenction is made using the ASP thread identity, which is either the app pool identity or the impersonated user identity. Whichever login ends up being used, this login must have the priviledges necessary to deploy the SqlDependency infrastructure (create a queue, create a service, create a stored procedure). The simplest way is to simply make this login's user in the database member of the db_owner role (which is the correct wording for what the article calls 'dbo priviledges').

So depending on yoru connection string, your app pool identity and your impersonation settings, the database user that corresponds to the login used by the map provider must be added to the db_owner role. I can't tell what you need to do, because it all depends on the variable factors enumerated above.

Remus Rusanu
Thakns everyone for the info. I have made the asp.net worker proccess run under my own name which is a domain account with dbo rights to the sitemap database. I also even tried using SSPI for the sitemap connection string. Still, no matter what, the OnSiteMapChanged event never fires, so the sitemap remains stale until whenever ASP.NET decides to invalidate the _root member on my SqlSiteMapProvider (which inherits from StaticSiteMapProvider). I'm losing my mind here over this thing - don't understand how something that appears to be used widely I cannot get working and no one else has had same
dferraro
You must understand how SqlDependency works, as I explained in the link http://rusanu.com/2006/06/17/the-mysterious-notification/. then you'll be able to troubleshoot it. Does the SqlDendepndy.Start infrastucture get deployed? Does the query get subscribed? Does the notification gets fired? does the notifictaion gets delivered? Have you looked in sys.dm_qn_subscriptions? have you looked in sys.transmission_queue? Just because some article says 'you must be dbo' (which is wrong, btw), doesn't mean that *your* problem is an access problem.
Remus Rusanu
thanks Remus. I will go through that page.. Do you know if anything changed though with SQL 2008? Because that is what we are on now.. Thanks again!
dferraro