Solution to the failure to start ASP. Net state service error 15:19:47 large medium small specific error: exception details: system. Web. httpexception: unable to send a session State request to the session state server. Make sure that ASP. Net state service has been started and the client and server ports are the same. If the server is on a remote computer, check the value of HKEY_LOCAL_MACHINE/system/CurrentControlSet/services/aspnet_state/parameters/allowremoteconnection to ensure that the server accepts remote requests. Source error: an unprocessed exception is generated during the execution of the current Web request. You can use the following exception stack trace information to determine the cause and location of the exception. Method 1: Start ASP in "service" in "Administrative Tools. net State Service "Method 2: Web. in config, the mode of sessionstate is set to StateServer, but the specified server does not enable that service. Method 2: Set sessionstate to StateServer in Web. config, but the specified server does not enable the service. Change to inproc. Method 3: Turn off anti-virus software. You can think that the file generated during the operation is virus-infected and will block the page generation from sending session Status requests to the session Status server. Make sure that ASP. NET State Service (ASP. NET State Service) is started and the client port is the same as the server port. If the server is on a remote computer, check the value of HKEY_LOCAL_MACHINE/system/CurrentControlSet/services/aspnet_state/parameters/allowremoteconnection to ensure that the server accepts remote requests. If the server is located on the local computer and the registry value mentioned above does not exist or is set to 0, the status server connection string must use "localhost" or "127.0.0.1" as the server name. Error: system. Web. httpexception: unable to send a session Status request to the session Status server. Make sure that ASP. Net state service has been started and the client and server ports are the same. If the server is on a remote computer, check the value of HKEY_LOCAL_MACHINE/system/CurrentControlSet/services/aspnet_state/parameters/allowremoteconnection to ensure that the server accepts remote requests. Source error: an unprocessed exception is generated during the execution of the current Web request. You can use the following exception stack trace information to determine the cause and location of the exception. Cause Analysis: In web. config, the mode of sessionstate is set to StateServer, but the server does not enable or change services. Solution: 1. web. in config, change the sessionstate mode to "inproc"; 2. enable "ASP. net state service. Later, I found the cause on the Internet. Session model overview what is a session? Simply put, it is the number that the server sends to the client. When a WWW server is running, several users may browse the website running on this server. When a user establishes a connection with the WWW server for the first time, the user establishes a session with the server, and the server automatically assigns a sessionid to the user to identify the unique identity. This sessionid is a random string consisting of 24 characters on the WWW server. We will see it in the following experiment. This unique sessionid has great practical significance. When a user submits a form, the browser automatically attaches the user's sessionid to the HTTP header information (this is the browser's automatic function that the user will not notice ), after the server processes the form, it returns the result to the user corresponding to the sessionid. Imagine how the server knows which user submitted the form when two users register simultaneously without sessionid. Of course, sessionid has many other functions, which we will mention later. In addition to sessionid, each session contains many other information. However, for ASP or ASP. NET Programming and programming, the most useful thing is to access ASP/ASP. NET's built-in Session object to store their own information for each user. For example, if we want to know how many pages a user visits our website browses, we may add the following to each page that a user may access:
You can use the following sentence to learn about several pages you have browsed:
Some readers may ask: where does this seemingly array SESSION ("...") come from? Do I need to define it? In fact, this session object is a built-in object of the WWW server with ASP explanatory power. That is to say, this object has been defined for you in the ASP system, and you only need to use it. The variable name in session ("...") is like the variable name. In session ("...") = $, $ is the variable value. You only need to write a sentence to access the value in the variable .. on every page of the user. In fact, Asp has a total of seven built-in objects, including session, application, Cookie, response, request, server, etc. Similar objects are also available in other server-side scripting languages such as JSP and PHP, but they are not the same in terms of naming or usage. ASP session functional defects ASP developers are currently using the powerful session feature, but they found that ASP session has the following defects: Process dependency: the ASP sessionstate is stored in the iisprogress, and the program inetinfo.exe is also used. When the inetinfo.exe process crashes, the information is lost. In addition, restarting or disabling the IIS service will cause information loss. Limitations of the range of session Status usage: when a user accesses another website from one website, the session information will not be migrated. For example, there may be more than one WWW server on the Sina website. After a user logs on, he/she will go to various channels, but each channel is on a different server, what if I want to share session information on these www servers? Cookie dependency: in fact, the client's session information is stored in the cookie. If the client completely disables the cookie function, it cannot enjoy the function provided by the session. In view of the above defects of ASP session, Microsoft designers are designing and developing ASP. net session, and the above defects are completely overcome, making ASP. net session has become a more powerful feature. Introduction to the Web. config file some ASP. NET programmers say: What is the Web. config file? I have never heard of it, but can the program I wrote work properly? Yes, you are right. Without the Web. config file program, it can run normally. However, if you create a large website, you need to make some overall configuration for the entire website, for example, you need to use the web. config file. Although some options in the web. config file can be configured through IIS, if the corresponding settings in Web. config also overwrite the configuration in IIS. In addition, the biggest convenience of the web. config file is that you can access the settings in Web. config by calling the system. Web namespace on the ASP. NET page. There are two types of Web. config: the server configuration file and the web application configuration file, both named Web. config. This configuration file stores a series of information about the web pages written in the current IIS server in which language, the Application Security Authentication mode, and the session information storage mode. This information is saved using XML syntax. If you want to edit it, use a text editor. The server configuration file takes effect for all applications on all sites on the IIS server. In. NET Framework 1.0, the Web. config file of the server exists in/winnt/Microsoft. NET/framework/v1.0.3705. The Web application configuration file web. config is stored in various web applications. For example, if the root directory of the current website is/inetpub/wwwroot and the current web application is myapplication, the root directory of the Web application should be/inetpub/wwwroot/myapplication. If your website has only one web application, the root directory of the application is/inetpub/wwwroot. To add a web application, add a virtual directory with the application starting point in IIS. The files and directories under this directory are considered as a web application. However, adding a web application through IIS does not generate a web. config file for you. To create a web application with a web. config file, use Visual Studio. NET to create a web application project. The Web. config configuration file of the Web application is optional and optional. If not, each web application uses the Web. config configuration file of the server. If yes, the corresponding values in the web. config configuration file of the server will be overwritten. In ASP. NET, modifications to Web. config will automatically take effect immediately after they are saved. You do not need to restart the web application to take effect after modifying the configuration file in ASP. The session configuration information in the web. config file opens the Web. config configuration file of an application, and we will find the following section: How does the configuration application store session information. The following operations mainly aim at this configuration section. Let's take a look at the meaning of the content contained in this section. The syntax of the sessionstate node is as follows: the required attribute is the description mode of the attribute option, where the session information is stored, off, And inproc is set to store the session in the process, is the storage method in ASP, which is the default value. StateServer is set to store sessions in independent State services. Sqlserver settings store sessions in SQL Server. The optional attribute is: attribute option description cookieless sets where session information of the client is stored. ture uses cookieless mode. False uses cookie mode. This is the default value. Timeout specifies the number of minutes after which the server automatically waives the session information. The default value is 20-minute stateconnectionstring, which indicates the server name and port number used to store session information in the status service. For example, "TCPIP = 127.0.0.1: 42424 ". This attribute is required when the mode value is StateServer. Sqlconnectionstring sets the connection string when connecting to SQL Server. For example, "Data Source = localhost; Integrated Security = sspi; initial catalog = northwind ". This attribute is required when the mode value is sqlserver. Statenetworktimeout sets the number of seconds after the session state is stored in StateServer mode and the TCP/IP connection between the Web server and the server that stores the status information. The default value is 10 seconds. The session Status of the client in ASP. NET is stored in the session model introduction above. You can find that the session status should be stored in two places: the client and the server. The client is only responsible for saving the sessionid of the corresponding website, while other session information is stored on the server. In ASP, the sessionid of the client is actually stored as a cookie. If the user chooses to disable cookies in the browser settings, then he will not be able to enjoy the convenience of the session, or even access some websites. To solve the above problems, the session information storage methods of the client in ASP. NET are divided into cookie and cookieless. In ASP. NET, by default, session information is stored on the client using cookies. If you want to use cookieless on the client to store session information, find the root directory of the current web application and open the web. find the following section in the config file: Change cookieless = "false" to cookieless = "true" in this section, so that the session information of the client will no longer be stored using cookies, instead, they are stored through URLs. Close the current IE, open a new IE, and re-access the Web application, you will see something like the following: http: // localhost/mytestapplication/(ulqsek45heu3ic2a5zgdl245) /default. the session ID of the client is highlighted in Aspx. Note that this information is automatically added by IIS and does not affect the normal connection. ASP. NET Server session state storage preparation for you to better experience the experiment phenomenon, you can create a session state. the following code is added to the ASPX page. Sub session_add (sender as object, e as eventargs) session ("mysession") = text1.value span1.innerhtml = "session data updated!
Your session contains: "&/SESSION (" mysession "). tostring () & "End sub checksession (sender as object, EAS eventargs) if (Session (" mysession ") is nothing) Then span1.innerhtml =" nothing, session data lost! "Else span1.innerhtml =" your session contains: "&/SESSION (" mysession "). tostring () & "" end if end sub sessionstate. the ASPX page can be used to test whether session information is lost on the current server. Store the server session information in the process. Let's go back to the section in the web. config file: When the mode value is inproc, it indicates that the server is using this mode. This method is the same as the previous ASP mode, that is, the server stores session information in the IIS process. When IIS is disabled or restarted, the information is lost. However, this mode also has its own biggest advantage, that is, the highest performance. It should be that all session information is stored in the IIS process, so IIS can quickly access this information, the performance of this mode is much faster than that of session information stored outside the process or stored in SQL Server. This mode is also the default mode for ASP. NET. Now let's do a test. Open the sessionstate. ASPX page and enter some characters to store them in the session. Then, let's restart IIS. Note that it is not to stop the current site and start again, but to right-click the node of the machine name in IIS and choose restart IIS. (To restart IIS when NT4 is used, you must restart the computer to restart IIS. Microsoft returns the sessionstate. on the ASPX page, check the session information and the message is lost. Store the server session information outside the process. First, let's open the management tool> service, find the service named ASP. NET State service, and start it. In fact, this service is to start a process to save session information. After starting this service, you can see a process named aspnet_state.exe in the Windows Task Manager> process. This is the process for saving session information. Return to the preceding section in the web. config file and change the mode Value to StateServer. Open another IE after saving the file, open the sessionstate. ASPX page, and save some information to the session. At this time, let's restart IIS and go back to the sessionstate. ASPX page to check the session information. We found that the session information was not lost. In fact, this method of storing session information outside the process not only means that the information can be stored in the local process, but also the session information can be stored in other server processes. In this case, you not only need to change the mode Value to StateServer, but also need to configure the corresponding parameters in stateconnectionstring. For example, if you want to store the session in the process of a computer whose IP address is 192.168.0.2, you need to set it to stateconnectionstring = "TCPIP = 192.168.0.2: 42424 ". Of course, do not forget to install. NET Framework on 192.168.0.2 and start the ASP. NET State Services Service. Store Server session information in SQL Server. First, let's make some preparations. Start the SQL Server and SQL Server proxy services. Execute a script file named installsqlstate. SQL in SQL Server. This script file will create a database in SQL Server for storing session information and an SQL Server proxy job for maintaining the session information database. We can find the file in the following path: [System Drive]/winnt/Microsoft. net/framework/[version]/then open the query analyzer, connect to the SQL Server server, open the file just now and execute. Wait a moment and the database and job will be created. In this case, you can open the Enterprise Manager and see a new database called aspstate. However, this database only contains some stored procedures and does not use user tables. In fact, session information is stored in the aspstatetempsessions table of the tempdb database, and the other aspstatetempapplications table stores the Application Object Information in ASP. These two tables are also created by the script just now. In addition, you can view "manage"> "SQL Server proxy"> "job" and find another job called aspstate_job_deleteexpiredsessions. This job actually deletes expired session information from the aspstatetempsessions table every minute. Then, we return to the Web. config file and change the mode Value to sqlserver. Note: You must also modify the sqlconnectionstring value in the format of sqlconnectionstring = "Data Source = localhost; Integrated Security = sspi;" data source refers to the IP address of the SQL Server server, if SQL Server and IIS are a sub-machine, you can write 127.0.0.1. Integrated Security = sspi means to use Windows Integrated Identity Authentication, so that accessing the database will use ASP.. Net identity, through this configuration, you can obtain better security than the SQL Server authentication method using userid = sa; Password = password. Of course, if SQL server runs on another computer, you may need to maintain consistency between the two sides through Active Directory domains. Similarly, let's do a test. Add the session information to sessionstate. aspx and you will find that the session information already exists in SQL Server. Even if you restart the computer, the session information will not be lost. Now you have fully seen what the session information looks like and is stored in SQL Server. What you can do depends on your performance. Haha. Through this article, you can see that ASP. NET has made great progress in session management and maintenance, and we can select a suitable method at will. For enterprise applications, this is undoubtedly beneficial to server synchronization, server stability, and reliability. I believe that with the support of powerful Microsoft, the new generation of e-commerce platforms will be built better! At the same time, you will also find that the entire technology includes the integration of operating systems, Web Services, and database technologies. I believe that windows is not UNIX stable, IIS is not apache stable, and SQL server is not powerful as Oracle. But who can perfectly link them together? So, although Microsoft is not too strong in every aspect, if we integrate everything from Microsoft into one, who would say that it is not powerful? Microsoft is Microsoft! This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/sntyy/archive/2008/02/13/2090347.aspx to start ASP. NET State Service Control Panel-> management tools-> services-> Start ASP. NET State Service http://hiphotos.baidu.com/zhidao/pic/item/9825bc31db47298e5edf0e29.jpg