日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 >

第七章   配置文件与网站部署

發(fā)布時間:2025/5/22 72 豆豆
生活随笔 收集整理的這篇文章主要介紹了 第七章   配置文件与网站部署 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

? ? ? ? ? ? ? ? ? ? ? ? ? ?第七章 ? ?配置文件與網(wǎng)站部署

1.配置文件管理:

? ? ? ?(1).配置文件:①machine.config(有且只有一個)

? ? ? ? ? ? ? ? ? ? ②web.config(每個站點都有一個web.config)

? ? ? ?(2)配置連接字符串:

? ? ? ? ? ?<connectionString>

? ? ? ? ? ? ? ?<add name="配置名" connectionString="server=.;database="數(shù)據(jù)庫名";uid=sa;pwd=123456;"/>

? ? ? ? ? ?</connectionString>

? ? ? ? ? ?<appsettings>

? ? ? ? ? ? ? ?<add key="xxx" value="xxx"/>

? ? ? ? ? ?<appsettings>

? ? ? ?(3)使用連接字符串:

? ? ? ?private ?static string connectionString = configurationManager.connectionString["配置名"].ToString();


? ? ? ?(4)數(shù)據(jù)庫連接字符串的加密和解密:(vs命令提示)(加密和解密必須在同一機上完成)

? ? ? 加密: aspnet_regiis.exe ?-pef section physical_directory -prov provider

? ? ? ? ? ? 或者

? ? ? ? ? ? aspnet_regiis.exe ?-app section physical_directory -prov provider


? ? ? 解密:aspnet_regiis.exe ?-pdf section physical_directory -prov provider


2.自定義錯誤的配置

? ? ? ?<system.web>

? ? ? ? ? ?<customErrors mode="on" defaultRedirect="">

? ? ? ? ? ? ? ?<error statusCode="404" redirect=""/>

? ? ? ? ? ? ? ?<error statusCode="403" ?redirect=""/>

? ? ? ? ? ?</customErrors>

? ? ? ? </system.web>

? ? ? ?defaultRedirect:指定發(fā)生錯誤時,瀏覽器重定向到頁面的url

? ? ? ?mode:指定自定義錯誤的狀態(tài),on表示啟用,off表示禁用,remoteonly表示其顯示給遠(yuǎn)程計算機.

? ? ? ?statusCode:http的狀態(tài)碼,404表示未找到資源,403表示禁止訪問.

? ? ? ?redirect:指定當(dāng)前錯誤發(fā)生時,重定向到頁面的url.

3.身份驗證和授權(quán)配置:

? ?(1)身份驗證:windows驗證

? ? ? ? ? ? ? ?forms驗證

? ? ? ? ? ? ? ?passport驗證

? ? ? ? ? ? ? ?<system.web>

? ? ? ? ? ? ? ? ? ?<authentication ?mode="windows">

? ? ? ? ? ? ? ? ? ?<authentication ?mode="Forms">

? ? ? ? ? ? ? ? ? ? ? ?<forms name="user" loginUrl="" timeout="60"></forms>

? ? ? ? ? ? ? ? ? ?</authentication>

? ? ? ? ? ? ? ? ?<authentication ?mode="passport">

? ? ? ? ? ? ? ?</system.web>

? ?(2)授權(quán)

? ? ? ?<!

<?xml version="1.0"><configuration><system.web><authorization><!--禁止匿名用戶--><deny users="?"/><!--允許管理員角色--><allow roles="admin"/></authorzation></system.web></configuration>


轉(zhuǎn)載于:https://blog.51cto.com/7112081/1343378

總結(jié)

以上是生活随笔為你收集整理的第七章   配置文件与网站部署的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。