在我的一个WEBSERVICE中,根据搜索的结果生成了一个XML文件,代码大致如下:
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load( Server.MapPath("1234.xml") ); //前面的程序已经生成并且保存正确
while ("条件" )
{
string myComputerName = "123";
myComputerName = IpAndHost.ComputerNameToXmlComputerName(myComputerName);
string myXpath = "//aa" + "/"+ "bb" + "/" + "cc";
XmlNode xnl=xmlDoc.SelectSingleNode(myXpath);
if (xnl == null)
{
XmlNode root=xmlDoc.SelectSingleNode( "//aa" + "/" + "bb" ); //查找上级节点
XmlElement xe1=xmlDoc.CreateElement(myComputerName); //创建节点
XmlElement xesub1 = xmlDoc.CreateElement("Name");
xesub1.InnerText = comPuter[i].Name;
xe1.AppendChild(xesub1);
root.AppendChild( xe1 );
myXpath = "";
}
}
xmlDoc.Save(Server.MapPath("1234.xml"));
同样的语句,在WINform下就可以正常的保存,在webmasterservice中就无法正确保存,只保存了循环中最后一个的结果
请各位高手帮忙看看有什么问题
多谢了
断点调试下,看看前面是否有值
确定对1234.xml有读写权限!!!
webmasterservice的用户的权限问题吧
要设置ASPNET_User的读写权限