ASP. NET web clusters use SQL Server to save the status

Source: Internet
Author: User

Refer to the followingArticle

Using SQL Server for Asp.net session state

ASP. NET session state management using SQL Server

 

The installation process and brief description are as follows:

1. Installation and setting of ms SQL Server

1. Install ms SQL Server 2000 Simplified Chinese Enterprise Edition according to the default settings. Note that the user authentication adopts the hybrid authentication method, and the SA user password cannot be too simple. Set the SQL Server database file storage directory to D, and Install SQL server system files to the default directory.
2. Install patch ms SQL Server 2000 sp3ProgramTo ensure the security of the SQL Server database.

Ii. Status Service database installation and Setup

Create a database
• Start the "SQL query analyzer" to link to the SQL Server database installed on the Status server.
• Open and execute the installsqlstate. SQL script file. By default, the file is stored in system drive \ windows \ Microsoft. net \ framework \ version \ directory, In this server, the script file location is: C: \ WINDOWS \ Microsoft. net \ framework \ v1.1.4322 \ installsqlstate. SQL
• If you use trusted connections to link to a database (we do not use this method), you must modify the ownnership of the database after creating the database ). In "SQL query analyzer", run:

Use Aspstate
Exec Sp_changedbowner ' SA ' , ' True '

• If you use SQL verification to connect to the database and access the database (this method is used), you need to create an SQL user for session state. The minimum permission required is: execute the stored procedure in the aspstate database.
If you are not at risk, you can set this user as the dbo of the aspstate database.
Create a user aspnetstate and set the user to the dbo_owner role of the aspstate database and tempdb database.

Fix bugs
Because installsqlstate. SQL is installed on SQL Server 2000 sp3 with a bug in access permissions, you need to make some corrections. Please follow the instructions below.
1. Run the following statement in "SQL query analyzer" to set cross-database ownership chaining

Use Master
Go
Exec Sp_configure ' Cross dB ownership chaining ' , ' 0 ' ; Reconfigure
Go

2. Restart SQL Server and run the following commands in "SQL query analyzer ":

Use Master
Go
Exec Sp_dboption ' Aspstate ' , ' DB chaining ' , ' True '
Go

Iii. Web Server Configuration
Modify the configuration in Web. config on the Web Server

< Sessionstate Mode = "Sqlserver" Stateconnectionstring = "TCPIP = 192.168.1.238: 42424" Sqlconnectionstring = "Data Source = 192.168.1.238; user id = aspnetstate; Password = PWD"
Cookieless = "False" Timeout = "40"   />

PWD is replaced with a real password.

Other bugs:
In the actual installation process, I can follow the above steps. However, after the status server is restarted, the user does not have the permission to access the tmpdb database. The error message is as follows:
Select permission denied on Object 'aspstatetempapplications ', database
'Tempdb', owner 'dbo '.
Insert permission denied on Object 'aspstatetempapplications ', database
'Tempdb', owner 'dbo '.
Select permission denied on Object 'aspstatetempapplications ', database
'Tempdb', owner 'dbo '.

After checking, the DBO account of the tmpdb database is lost after the server is restarted. After consulting with Microsoft, the answer is "The tmpdb database clears the DBO account after each restart ",

Therefore, the temporary solution is:
Grant the account verified in sqlserver connnectionstring the system administrator permission in sqlserver. In this way, whether or not the system administrator is restarted, the two tables in tempdb are accessed by the permission. This solution has some security risks. Pay attention to the system security.

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.