Asp.net configures session for sqlserver Verification

Source: Internet
Author: User

Reprinted: http://jopwu.blog.163.com/blog/static/73025412011112114850183/

 

SQLServer

(1).net2.0above, it is suggested that the aspnet_regsql.exe tool should be used instead of the command line, such as aspnet_regsql-C "Data Source =.; Integrated Security = True"-ssadd-sstype c-d SessionStateDB
The cause is that the tool is prone to errors: SQL Server does not have ASP. NET 2.0 session Status installed, so SQL Server cannot be used. Install ASP. NET session Status SQL Server 2.0 or later. The configuration file should be in the following format: <sessionState mode = "SQLServer" allowCustomSqlDatabase = "true" sqlConnectionString = "data source = VM2008; initial catalog = SessionStateDB; user id = sa; password = ioffice "timeout =" 30 "/> (2) when the machine exists at the same time. net1.1 and. we recommend that you use net2.0. net2.0 script.
(3) The SQLServer mode is easy to bring efficiency overhead. Each page reads and writes the database twice. Solution. system. modify the page attributes on the web, such as <pages enableSessionState = "ReadOnly"> or <pages enableSessionState = "False">. readonly is generally used in ioffice. At the same time, EnableSessionState = "True" of the page on which the session needs to be rewritten is usually used to log on to the logout page.

Aspnet_regsql.exe Parameter Parsing

-- General options --

-? This help text is displayed.

-W wizard mode. (If other parameters are not specified, this mode is used by default .)

-- SQL connection options --

-S <server> the SQL Server instance to be used (SQL Server 7.0 and later ).

-U <login id> is the SQL Server user name used for authentication. The-P option is required.

-P <password> indicates the SQL Server password used for authentication. The-U option is required.

-E use the current Windows credential for authentication.

-C <connection string>
The connection string. The user name, password, and Server name are not specified, but the SQL Server
The connection string. This string cannot contain the database name unless otherwise specified.

-Sqlexportonly <filename>
Generate an SQL script file that is used to add or remove a specified function but does not perform actual operations. It can be used with the following options:-A,-R,-ssadd, and-ssremove.

-- Application service options --

-A all | m | r | p | c | w added support for A function. You can specify multiple values at the same time. For example:

-A mp-A m-A p

All: all functions m: Membership r: Role Manager p: Configuration File
C: personalized settings w: SQL Web event provider

-R all | m | r | p | c | w removes the support for a function. You can specify multiple values at the same time. For example:

-R mp-R m-R p

All: all features and all public tables and stored procedures shared by these features m: Membership
R: Role Manager p: configuration file c: personalized settings w: SQL Web event provider

-D <database> indicates the name of the database used for application services. If no database name is specified, the default database "aspnetdb" is used ".

-Q quiet mode. The confirmation dialog box is not displayed when the function is removed.

-- SQL cache dependency option (for SQL 7.0 and 2000 )--

-D <database> indicates the name of the database used for SQL cache dependencies in SQL 7.0 and SQL 2000. You can also choose to use a connection string with the-C option to specify the database. (Required)

-Ed enables the database for SQL cache dependencies.

-Dd disables the database for SQL cache dependencies.

-Et enables the table for SQL cache dependencies. The-t option is required.

-Dt indicates that the SQL cache dependency is disabled. The-t option is required.

-T <table> name of the table to be enabled or disabled for the SQL cache dependency. -Et or-dt is required.

-Lt lists all tables enabled for SQL cache dependencies.

-- Session status option --

-Added support for SQL Server Mode session Status in ssadd.

-Ssremove removes support for SQLServer mode session states.

-Sstype t | p | type supported by c session Status:

T: temporary. Session status data is stored in the "tempdb" database. The stored procedure for session management is installed in the "ASPState" database. If you restart SQL, data is not maintained. (Default)

P: Keep. Session status data and stored procedures are stored in the "ASPState" database.

C: custom. Session status data and stored procedures are stored in the custom database. The database name must be specified.

-D <database>-the name of the custom database used when sstype is "c.

Conclusion: Save the Session in Sqlserver mode: enter C: \ WINDOWS \ Microsoft. NET \ Framework \ v2.0.50727 in the command line.
Aspnet_regsql.exe-C "Data Source =.; Integrated Security = True"-ssadd-sstype p

You can create an ASPState database to save the Session status.

 

The following content was used in the Lanzhou monitoring project in 2013:

Configured on the hazelz Database

 

Tool Path: C: \ Windows \ Microsoft. NET \ Framework \ v4.0.30319

Aspnet_regsql.exe-C "Data Source = SDWM-20130311QK \ SQLEXPRESS; Integrated security = true"-ssadd-sstype c-d "hazelz"

 

 

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.