Thursday, December 23, 2010

How to enable SQL Dependency on SQL 2008 Server for .NET Website Caching




How to enable SQL Dependency on SQL 2008 Server for .NET Website Caching

I am unable to put the code on blogget.com don't know why.
So please visit: my blog on word press for complete blog post.

In your web.config make sure have tag declared as shown below:
Then run these commands using your command prompt:

To Enable Sql Dependency:
aspnet_regsql.exe -S localhost -E -d pubs -t authors -et
or if this doesn't work then try this:
aspnet_regsql.exe -S localhost -U your_db_username -P your_db_password -d pubs -t authors -et

or if you want to allow to whole database then try this:
aspnet_regsql.exe -S localhost -U your_db_username -P your_db_password -d pubs -ed

To Disable Sql Dependency:
aspnet_regsql.exe -S localhost -E -d pubs -t authors -dt

or if this doesn't work then try this:
aspnet_regsql.exe -S localhost -U your_db_username -P your_db_password -d pubs -t authors -dt

or if you want to allow to whole database then try this:
aspnet_regsql.exe -S localhost -U your_db_username -P your_db_password -d pubs -dt

Than just add the output cache in your asp.net page or contols (.aspx or .asmx) pages.
<outputCache enableOutputCache ="true" duration = "1000" varByParam="None">

Hope this helps!

No comments:

Post a Comment