Tips for logging on to the system again to avoid compilation in Asp.net Program Development

Source: Internet
Author: User
Recently, I was working on a business system. During the project, I found that I had to constantly modify the system, compile the system, and log on to the system. I found that the repetitive work was too heavy.
The session of the Asp.net program is saved in the IIS process by default. When the bin directory file compiled by the project is rewritten, the IIS process restarts and the session is naturally lost, of course, you have to log on again.
Therefore, the session is saved to other places by configuration. In Asp.net, the session is saved in the following ways: IIS process (default), StateServer, database, and custom mode. In StateServer mode, I configure ASP to be saved on the local machine.. Net Status Service, successful, but want to save to other machines is always failed, I do not know why, is saved in the local ASP. in the net status service, the address of the target machine in stateconnectionstring can only be localhost or 127.0.0.1. if I change it to my machine name or IP address of the LAN, it will not work. Later, I only need to configure it to the database.
First, you need to create a status database (this is simple), and then generate tables, stored procedures, and other things of the status database. Run the following command at the. NET prompt:

D: \ Program Files \ Microsoft Visual Studio 8 \ Vc> aspnet_regsql-ssadd-s 192.168.0.
200,1533-U sa-P Sa-D asp_state-sstype C

Start adding session status.

..

Completed.

To use this custom session status database in a web application, specify it in the configuration file
Use "allowcustomsqldatabase" and "sqlconnecti" in the <system. Web >\< sessionstate> section
Onstring attribute.

Create an urban management database Association. Modify the Web. config file as follows:
<Sessionstate mode = "sqlserver" allowcustomsqldatabase = "true" stateconnectionstring = "TCPIP = 127.0.0.1: 42424"
Sqlconnectionstring = "Data Source = 192.168.0.223; database = asp_state; uid = sa; Pwd = sa"/>

After this is done, you do not need to log on again when compiling the code, and the database is saved on another machine. Even if my machine restarts, you do not need to log on again (of course, when the session has not expired, sqlserver has a job that regularly deletes expired session records) because the session status information has been saved in the database ..

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.