Home All Groups Group Topic Archive Search About

SqlDependency fails when not connected to domain

Author
23 Jun 2006 12:34 PM
Jason Saidoo
SqlDependency seems to work for me just fine when I am at work and logged
into my work domain.  I attempted to demo SqlDependency outside of the office
and it simply would not work.  In debugging, there are zero errors, and the
code seems to execute "SqlDependency.Start(strConnectionString)" without
error or delay.  The onchange handler never gets called even though I've
changed and/or added rows to the table being monitored (the same changes that
work when I'm logged into my work domain).

I've tried:
* connecting to the database using localhost and machine name
* connecting using windows auth and SQL Auth (both system admins and dbo)
* using inline SQL vs. Stored Procedure
* using very simple query (SELECT Column1 FROM dbo.Table1)
* restoring a backup copy of the database on a Virtual PC not associated
with a domain
* running the test application on the above virtual PC

If (while away from the office) I VPN into our network, the SqlDependency
works perfectly.  Disconnect the VPN and the onchange handler is never called
again. 

Also, once the dependency is created, I can see a service and a queue
created (looking in Management Studio).  I can also see messages in the queue
that seem to never be delivered to my application.

Any ideas?

Author
29 Jun 2006 4:12 PM
Jason Saidoo
I think I found the answer.  The database for which I was attempting to use
the dependency was created with an owner of "domain\jsaidoo" (I'm using
windows authentication by default).  I switched the owner to "sa" and the
dependency magically started working.

Show quote
"Jason Saidoo" wrote:

> SqlDependency seems to work for me just fine when I am at work and logged
> into my work domain.  I attempted to demo SqlDependency outside of the office
> and it simply would not work.  In debugging, there are zero errors, and the
> code seems to execute "SqlDependency.Start(strConnectionString)" without
> error or delay.  The onchange handler never gets called even though I've
> changed and/or added rows to the table being monitored (the same changes that
> work when I'm logged into my work domain).
>
> I've tried:
> * connecting to the database using localhost and machine name
> * connecting using windows auth and SQL Auth (both system admins and dbo)
> * using inline SQL vs. Stored Procedure
> * using very simple query (SELECT Column1 FROM dbo.Table1)
> * restoring a backup copy of the database on a Virtual PC not associated
> with a domain
> * running the test application on the above virtual PC
>
> If (while away from the office) I VPN into our network, the SqlDependency
> works perfectly.  Disconnect the VPN and the onchange handler is never called
> again. 
>
> Also, once the dependency is created, I can see a service and a queue
> created (looking in Management Studio).  I can also see messages in the queue
> that seem to never be delivered to my application.
>
> Any ideas?

AddThis Social Bookmark Button