- 1、運行里的CONFING打不開,提示找不到CONFIG這個文件,怎麼辦?
- 2、求救!開機找不到config文件
- 3、我怎麼new不出來jsonconfig
- 4、為什麼我找不到CONFIG文件夾
- 5、網站serverConfig.json載入失敗
你可能優化過系統,設置文件被你刪除了或者修改得不能使用了。
用系統修復台修復吧或者重裝。再或者就把
硬碟
掛到別人的機器上,搞個相同的設置文件~
那是你沒有正常關機程序沒來得及保存退出。所以文件就被破壞了。你用v盤到別人的電腦上把system複製過來,在用系統盤進人dos,然後把v盤插上(我不知道你的主板能不能從v盤啟動,可以的話就直接把dos複製到v盤上就行了。所以只好分開來用了)用命令copy system c:\windows\system32\config 就行了 或者你重裝或恢復下系統就行了
代碼:請導入 System.XML命名空間
string file = Server.MapPath(@”~\web.config”);
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(file);
string s1 = “aaa”;
string s2 = “bbb”;
string h = “ccc”;
string user = “ddd”;
string pass = “eee”;
XmlNodeList nodeList = null;
nodeList = xmlDoc.SelectSingleNode(“configuration//connectionStrings”).ChildNodes;
//遍歷所節點
foreach (XmlNode xn in nodeList)
{
//節點類型轉換XmlElement類型
XmlElement xe = xn as XmlElement;
if (xe.Name == “add”)
{
if (xe.GetAttribute(“name”) == “acountConnectionString”)
{
xe.SetAttribute(“connectionString”, s1);
}
if (xe.GetAttribute(“name”) == “mailaddress”)
{
xe.SetAttribute(“connectionString”, s2);
}
}
}
nodeList = xmlDoc.SelectSingleNode(“configuration//system.net//mailSettings//smtp”).ChildNodes;
foreach (XmlNode xn in nodeList)
{
//節點類型轉換XmlElement類型
XmlElement xe = xn as XmlElement;
if (xe.Name == “network”)
{
xe.SetAttribute(“host”, h);
xe.SetAttribute(“userName”, user);
xe.SetAttribute(“password”, pass);
break;
}
}
xmlDoc.Save(file);
顯示隱藏的文件夾試試,方法:工具-文件夾選項-顯示隱藏的文件夾(勾上)
網路連接失敗。網站serverConfig.json對於網路的需求是非常大的,只要該網站的網路連接失敗就會導致該網頁載入失敗,用戶可以通過更換新的網路來回復該網站的載入。
原創文章,作者:MX2UM,如若轉載,請註明出處:https://www.506064.com/zh-tw/n/127090.html