Asp.net uses SqlDependency To Cache Usage notes

Source: Internet
Author: User

Use SqlDependency cache in asp.net

1 first, you must enable the listener for the Test_01 database.

Test_01 ENABLE_BROKER;

Note: SELECT is_broker_enabled FROM sys. databases WHERE name = 'test _ 01'

Check whether this listener is enabled (0 is not enabled, 1 is enabled)

2. You must grant the send permission to the Guest user on the QueryNotificationService service in the Test_01 database. The method is as follows. Be case sensitive.

SEND Guest

3. Add the following nodes in web. config:

 

In the <system. web> node, add

 

4. Set the cache table when the program starts (set once)

ConStr = System. Configuration. ConfigurationManager. ConnectionStrings [
);

5. Save the cache in the query

SqlConnection conn = new SqlConnection (connstr );
SqlCommand cmd = SqlCommand (= System. Web. Caching. SqlCacheDependency (,); Cache. Insert (, ds, cd );

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.