[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.caching

ASP.NET caching with SQL Server doesn't work. Help needed.

mshakeelfaiz

2/26/2008 5:53:00 PM

Hello Toni,

How are you?

I got the same problem, I enabled the cache dependency on Northwind
database Employees table via this command

=========================================

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>aspnet_regsql.exe -S
asd120 -U sas -P 123 -ed -d Northwind -et -t Employees



Enabling the database for SQL cache dependency.

.

Finished.

Enabling the table for SQL cache dependency.





Finished.

=========================================

Then I checked the list of tables which have cache dependency enabled
via this command, and it showed me the list of tables as shown below

=========================================

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>aspnet_regsql -S asd120 -
U sas -P 123 -d northwind -lt

Listing all tables enabled for SQL cache dependency:

employees

=========================================

It means, I have successfully enabled the cache dependency on
Northwind Employees table.

My page OutputCache directive and Web.config settings look like this

=========================================

<%@ OutputCache Duration="3600" SqlDependency="Northwind:Employees"
VaryByParam="none" %>

<caching>

<sqlCacheDependency enabled = "true" pollTime = "1000" >

<databases>

<add name="Northwind"

connectionStringName="NorthwindConnectionString1"

pollTime = "1000"

/>

</databases>

</sqlCacheDependency>

</caching>

=========================================

But when I ran my aspx page, I got this error.

=========================================

The 'Employees' table in the database 'Northwind' is not enabled for
SQL cache notification.

Please make sure the table exists, and the table name used for cache
dependency matches exactly the table name used in cache notification
registration.

To enable a table for SQL cache notification, please use
SqlCacheDependencyAdmin.EnableTableForNotifications method, or the
command line tool aspnet_regsql. To use the tool, please run
'aspnet_regsql.exe -?' for more information.

To get a list of enabled tables in the database, please use
SqlCacheDependencyManager.GetTablesEnabledForNotifications method, or
the command line tool aspnet_regsql.exe.

=========================================

Now, when I change the table name from "Employees" to "employees" in
my OutputCache directive of my page, this error was resolved.

=========================================

<%@ OutputCache Duration="3600" SqlDependency="Northwind:employees"
VaryByParam="none" %>

=========================================

Regards,

Shakeel Faiz