在做一个SQl缓存依赖的 例子.(电脑装的 sqlexpress. northwind 数据库也装好了)
先在 web.config 中加入<caching>
<sqlCacheDependency enabled="true" pollTime="1000">
<databases>
<add connectionStringName="NorthwindConnectionString" name="Northwind" pollTime="1000"/>
</databases>
</sqlCacheDependency>
</caching>
和<connectionStrings>
<remove name="NorthwindConnectionString"/>
<add name="NorthwindConnectionString" connectionString="Data Source=.\sqlexpress;Initial Catalog=Northwind;Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
然后在页面的 load 里 加入System.Web.Caching.SqlCacheDependencyAdmin.EnableTableForNotifications(System.Configuration.ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString, "Orders");结果运行时就出现错误如下The database 'Northwind' is not enabled for SQL cache notification.To enable a database for SQL cache notification, please use the System.Web.Caching.SqlCacheDependencyAdmin.EnableNotifications method, or the command line tool aspnet_regsql. To use the tool, please run 'aspnet_regsql.exe -?' for more information.
哪位遇到过同样的问题麻烦指教一下 我google了一晚上也没有结果.............跪谢了 先
先在 web.config 中加入<caching>
<sqlCacheDependency enabled="true" pollTime="1000">
<databases>
<add connectionStringName="NorthwindConnectionString" name="Northwind" pollTime="1000"/>
</databases>
</sqlCacheDependency>
</caching>
和<connectionStrings>
<remove name="NorthwindConnectionString"/>
<add name="NorthwindConnectionString" connectionString="Data Source=.\sqlexpress;Initial Catalog=Northwind;Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
然后在页面的 load 里 加入System.Web.Caching.SqlCacheDependencyAdmin.EnableTableForNotifications(System.Configuration.ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString, "Orders");结果运行时就出现错误如下The database 'Northwind' is not enabled for SQL cache notification.To enable a database for SQL cache notification, please use the System.Web.Caching.SqlCacheDependencyAdmin.EnableNotifications method, or the command line tool aspnet_regsql. To use the tool, please run 'aspnet_regsql.exe -?' for more information.
哪位遇到过同样的问题麻烦指教一下 我google了一晚上也没有结果.............跪谢了 先
解决方案 »
- MyBody.Attributes.Add("onload", ...),读取参数后不能aplit.大家帮忙看看!!
- 如何把放在数据库中的PDF文件在ASP页面上打开?[
- 初学者发现了一个大问题呀??哪位能说清楚。。。。。。。。。。。
- 请问如何打包带sql2000,asp.net(c#)程序
- 我用VS2005开发,连接SQL Server2000,用到了“成员资格”功能,那么,这个功能使用哪个数据库?
- Visual Web Developer 2005 速成版的测试版 2的问题
- 谁有eip代码,架构公开,让大家看看阿
- 如何实现单击一个textbox,弹出一个对话框,对话框返回信息给textbox,如何实现呀?
- 报一个什么“不可恢复性错误”
- 我想实现一个公共函数或者变量,在每个。ashx文件都能调用,怎样才能实现?请高手指点,谢谢
- 怎么做日志
- 生成静态页面
ALTER DATABASE test SET enable_BROKER//设置数据库开启broker模式GRANT SUBSCRIBE QUERY NOTIFICATIONS TO "HYSF12\Administrator"//设置权限
sqlserver2000是轮询的方式缓存,不太会
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<caching>
<sqlCacheDependency enabled ="true">
<databases>
<add name="Northwind" connectionStringName ="NorthwindConnectionstring" pollTime ="500"/>
</databases >
</sqlCacheDependency >
</caching>
<%@ OutputCache Duration="3600" VaryByParam="None" SqlDependency="Northwind:Customers" %>aspnet_regsql.exe -E -S .\SqlExpress -d aspnetdb -ed SqlCacheDependency empDependency = new SqlCacheDependency(
"Northwind", "");
参考