Sql Server 2012 Express - Service Broker - Subscribe Query Notifications
To enable SQL Server 2012 Express real time data notifications to use with ASP.NET and SignalR:
- Run Sql
Documentation : Enable Query Notifications
ALTER DATABASE AdventureWorks SET ENABLE_BROKER;
CREATE QUEUE ContactChangeMessages;
CREATE SERVICE ContactChangeNotifications ON QUEUE ContactChangeMessages ([http://schemas.microsoft.com/SQL/Notifications/PostQueryNotification]);
GRANT SUBSCRIBE QUERY NOTIFICATIONS TO "DomainName\Username";
- Set SQL Server Permission for IIS App Pool
- http://stackoverflow.com/questions/7698286/login-failed-for-user-iis-apppool-asp-net-v4-0
- You need to add a login to SQL Server for IIS APPPOOL\ASP.NET v4.0 and grant permissions to the database.
- In SSMS, under the server, expand Security, then right click Logins and select "New Login...".
- In the New Login dialog, enter the app pool as the login name and click "OK".
- You can then right click the login for the app pool, select Properties and select "User Mapping".
- Check the appropriate database, and the appropriate roles. I think you could just select db_datareader and db_datawriter,
- but I think you would still need to grant permissions to execute stored procedures if you do that through EF.
- ASP.NET SqlDependency Example:
- http://msdn.microsoft.com/en-us/library/9dz445ks(v=vs.110).aspx