Thursday, December 12, 2013

SqlDependency must be called for each server that is being executed

Recently we rewrote our web applications in VS 2012 and .Net 4.0 and hosted it on IIS 7.For caching content I used the Sql Dependency and SQL service Service Broker.On test environment with load balancing we had two servers configured and everything was working as expected.


However when I moved the applications to production I started getting this error.







The only difference was the connectionstring which specified a failover server.

<add name="CONTENTDSN" connectionString="Data Source=Server1;Failover Partner=Server2;Initial Catalog=Database_Name;uid=UserId;pwd=password;"/>

The error was due to the failover server not having the database objects.Now when you use SQL dependency make sure that the failover server i.e Server2, has all the necessary database objects as the main server i.e. Server1.

No comments: