sql server - Cannot find the object "QueryNotificationErrorsQueue" because it does not exist or you do not have permissions -


i using sqldependecy signalr push notifications client browser when there database changes, followed this , this post , works fine in local sqlexpress version 11.0 local connection string , have kind of permissions problem when connect remote database hosted in godaddy production connection string

working local connectionstring

<!--<add name="notifyconnection" providername="system.data.sqlclient" connectionstring= "data source=.\sqlexpress;initial catalog=testdb;integrated security=sspi;" />--> 

production connectionstring

<add name="notifyconnection" connectionstring="server=000.00.00.000;database=testdb; user id=username;password=yourpassword;" providername="system.data.sqlclient" /> 

get data method

public ienumerable<order> getdata() {  using (var connection = new sqlconnection(configurationmanager.connectionstrings ["notifyconnection"].connectionstring)) {  using (sqlcommand command = connection.createcommand()) {  command.commandtype = commandtype.text;  command.commandtext = "select orderid,customerid dbo.[restuser]";  command.notification = null;  sqldependency dependency = new sqldependency(command); dependency.onchange += new onchangeeventhandler(dependency_onchange);  if (connection.state == connectionstate.closed) connection.open();  using (var reader = command.executereader()) return reader.cast<idatarecord>()   // here error throws        .select(x => new order()        {        orderid = x.getint32(0),        customerid = x.getint32(1)                           }).tolist();    }  }  } 

what have tried ?

i followed post grant permissions in sql server , not sure correct method follow.

use yourdatabasename;  create queue namechangequeue;  create service namechangeservice on queue namechangequeue ([http://schemas.microsoft.com/ sql/notifications/postquerynotification]);  grant subscribe query notifications yourusername; // here error:  //cannot grant, deny, or revoke permissions sa, dbo, entity owner, information_schema,    sys, or yourself.  alter database yourdatabasename set enable_broker;  // broker enabled 

screen shot:

enter image description here

i new sqldependency, how fix issue ?

any great.

in shared hosting because restrict features, unable use sqldependency, here solution play notifications without sqldependency in asp mvc

if new signalr, first try this post create simple chat web application.

my requirement play notifications when new sales happens in shops

1. create signalr server hub

signalr server hub class sends messages clients browser.

[hubname("pascalcasenewsaleshub")] public class newsaleshub : hub {      public void send(string shopid)     {         // call alertnewsalestopage method update clients.          clients.all.alertnewsalestopage(shopid);     }  } 

2. javascript send method in placeorder view

when customer places new order shop following javascript code calls send method on server hub update clients.

<script>  $(function ()  { // reference auto-generated proxy hub. var chat = $.connection.pascalcasenewsaleshub;  var thisshopid = @(viewbag.shopid);   // start connection. $.connection.hub.start().done(function () {  // call send method on hub send shops id  chat.server.send(thisshopid);   }); }); 

3. javascript client call method in shopsales view

the hub class on server calls javascript function push content updates each client.

<script type="text/javascript"> $(function ()  {  console.log('page loaded');  // declare proxy reference hub.  var notifications = $.connection.pascalcasenewsaleshub;  if (notifications != null) {  console.log('connected saleshub proxy'); }  var thisshopid = @(viewbag.shopid);  // create function hub can call alert new sales.  notifications.client.alertnewsalestopage = function (shopid) { // check if sales happened shop play notification  if (shopid == thisshopid)  {   var sound =new howl({           src: ['../sounds/rings.mp3','../sounds/rings.wav','../sounds/rings.ogg',           '../sounds/rings.aiff'],           autoplay: true,           loop: true           });            sound.play();            $('#loading').show();            // partial view update latestsales shop            $("#new-sales").load('@url.action("getlatestsales", "shop")')            $('#loading').hide();            console.log('new sale happened, notification played');         }      };       // start connection.     $.connection.hub.start().done(function () {           console.log('signalr connection started');       }).fail(function (e) {         alert(e);     }); });    </script> 

used howler.js plugin play notification , check this post.

hope helps someone.


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -