Development tools: vs2010,mvc4.0,sqlserver2008
Server: Windows Server 2012,iis8,sqlserver2012
First, after the release, each page opened very card, 50 seconds or longer, the second time opened soon
Estimated cause: Slow compilation, but not on machines with VS environment
Workaround:
- Use a high version of VS, "pre-compile during release";
- Using the IIS8 application initialization function
1. Use VS2017 to "precompile during release"
An error was encountered when publishing:
It is an error to use a section registered as allowdefinition= ' machinetoapplication ' outside the application level. This error can be caused if the virtual directory is not configured as an application in IIS.
Workaround: Comment The following code in Web. config at publish time
<!--<authentication mode= "Forms" > <forms loginurl= "~/account/login" timeout= "2880"/></ Authentication>-->
2. Using IIS8 's application initialization function
Http://jingyan.baidu.com/article/c843ea0bb6c13877931e4a2e.html
Ii. frequent loss of ASP.
Symptom: After 30 seconds of Login, the session is lost and needs to be logged in again.
WORKAROUND: ASP. NET has several session-state modes, the default is "InProc mode", changed to "StateServer mode", the problem is lifted
1. Off mode
The session is closed.
Full station close session can be written in the <system.web> section in the Web. config file:
<sessionstate mode= "Off" >
To close a session on a page, you can add:
<%@ page enablesessionstate= "false"%>
2. InProc mode (default mode)
If sessionstate mode is not configured in the Web. config file, the default is InProc mode.
If you want to customize the parameters of the InProc mode, you need to write the Web. config file, for example:
<sessionstate mode= "InProc" cookieless= "false" timeout= "/>"
cookieless sets whether to allow setting the time-out in minutes without using cookie,timeout.
The InProc mode relies on ASP. NET process, the session state saved in the process is lost when the IIS process crashes or restarts.
3. StateServer mode
The StateServer mode is to store session data in a separate memory buffer, which is controlled by a Windows service "ASP." (which needs to be opened in Windows Services) to control this buffer. You need to set stateConnectionString:
<sessionstate mode= "StateServer" stateconnectionstring= "tcpip=127.0.0.1:42424" timeout= "/>"
The advantage of the StateServer mode is that it is independent of the IIS process, and the restart of the IIS application does not affect session data.
4. SQL Server Mode
Use SQL Server to save the session, even if IIS restarts, the session will still not be lost. The ASPState database needs to be created first. Specific methods can be queried on the Internet.
Asp. NET sites when publishing those pits