常用web.config公共配置

来源:互联网 发布:人脸识别pca算法代码 编辑:程序博客网 时间:2024/06/10 04:13

11111111111
服务器配置文件:machine.config
应用程序配置文件:Web.config

2222222222
配置设置的应用--继承关系
检测配置文件的变化--自动检测
配置文件的格式--XML

33333333333333
连接字符串配置:
1、
<appSettings></appSettings>


<appSettings>
 <add key="title" value="hello"/>
 <add key="cnnStr" value="data source=.;initial catalog=数据库名;user id=连接数据库的账号;password=连接数据库的密码"/>
</appSettings>


2、
<connectionString></connectionString>

<connectionStrings>
     <add name="studentConStr" connectionString="data source=.;initial catalog=数据库名;user id=连接数据库的账号;password=连接数据库的密码"/>
</connectionStrings>


44444444444444
编译配置
<compilation debug="true" targetFramework="4.0"></compilation>


555555555555555
定制错误配置
<customErrors mode="On" defaultRedirect="abc.htm">
   <error statusCode="404" redirect="notfindpage.htm"/>
</customErrors>


66666666666666666
1、aspnet_regiis可以给配置文件中的某个标记加密

2、<sessionState mode="InProc" timeout="10"></sessionState>将session存放在本应用的进程中,一旦本应用结束,或者服务器停止服务,session就会被释放丢

3、<sessionState mode="StateServer" timeout="10"></sessionState>将session放置在服务器的另一个进程中,但是还是放在了服务器的内存中的,如果服务器断电等意外事件发生了,session依然会丢失。

 

原创粉丝点击