Normal database connection string configuration, which is the case where the MSSQL server port is 1433 (default).
<add key= "Article" value= "server=.; uid=admin;pwd=admin;database=db; " ></add>
But sometimes, for the database server to be secure, the port is changed to something else, and then connecting to the database may report the following error:
An error occurred while establishing a connection to the server. When you connect to SQL Server 2005, this failure may be caused by SQL Server not allowing remote connections under the default settings. (provider: Named pipe provider, ERROR:40-Unable to open a connection to SQL Server) just add the port number to it:
<add key= "Article" value= "server=., port slogan; uid=admin;pwd=admin;database=db;" ></add>
Port Modification Method:
"Start"--> "Server Network Utility"-->tcp/ip--> default port: 2433 (other can also)
StateServer Session Management
Set the Mode property to StateServer, which means that the session data is stored in a separate memory buffer, and then the Windows service running on a separate machine controls the buffer. The full name of the status service is "ASP.net State Services" (Aspnet_state.exe), which is configured by the stateConnectionString attribute in the Web.config file. This property specifies the server on which the service resides and the ports to monitor:
<sessionstate mode= "StateServer"
Stateconnectionstring= "tcpip=myserver:42424"
Cookieless= "false" timeout= "/>"
In this example, the State service runs on a 42424 port (the default port) of a machine named MyServer. To change the port on the server, you can edit the Hkey_local_machine\system\currentcontrolset\services\aspnet_state\parameters registry key in the
Port value.
Obviously, the advantage of using state services is process isolation, which can be shared in the Web farm. With this mode, session state storage will not depend on the failure or restart of the IIS process, however, all session data will be lost once the status service is aborted. In other words, the State service does not store data as persistently as SQL Server, it simply stores the data in memory.
Unable to issue a session-state request to the session-state server. Make sure that the ASP.net state Service (asp.net) is started and that the client port is the same as the server port. If the server is on a remote computer, check the hkey_local_machine\system\currentcontrolset\services\aspnet_state\parameters\ Allowremoteconnectio the value of N 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 (if you accept a remote connection if you change to 1), the state server connection string must use "localhost" or "127.0.0.1" as the server name.