We have a windows service running as an AD user invoking an SP to send a message from service A to service B.
If I run the sp, it works fine. If the service user runs the sp, the sp blows up with this error:
Cannot find the object "StatsMonitor" because it does not exist or you do not have permissions.
StatsMonitor is the target queue in this case.
Here is the code in the sp that blows up:
SET @Handle = NEWID() BEGIN DIALOG CONVERSATION @Handle FROM SERVICE StatsMonitorPublisher TO SERVICE 'StatsMonitorSubscriber' ON CONTRACT [http://schemas.foo.com/contracts/StatsMonitor] WITH ENCRYPTION = OFF; SEND ON CONVERSATION @Handle MESSAGE TYPE [http://schemas.foo.com/messages/StatsMonitor/MonitorNow](@MessageBody); END CONVERSATION @Handle if @debug = 1 begin print 'StatsMonitor message sent!' print CONVERT(VARCHAR(MAX), @MessageBody, 1); end
I tried the following but it didn't seem to help:
GRANT SEND ON SERVICE::[StatsMonitorPublisher]TO [foo\devservice] ;
Please advise.
thanks