webservices问题
[return: XmlElement(Namespace = "http://www.gzzc.com.cn",ElementName = "BookOrder")]
[WebMethod][SoapDocumentMethod]
public ReturnMessage CopyFile(string ip,string dir,string file)
{
ReturnMessage msg = new ReturnMessage();
ConnectionOptions options = new ConnectionOptions();
options.Username = "Administrator";
options.Password = "123";
ManagementScope scope = new ManagementScope(@"\\" + ip + @"\root\cimv2", options);
try
{
scope.Connect();
ManagementObject disk = new ManagementObject(scope, new ManagementPath("Win32_logicaldisk='c:'"), null);
disk.Get();
string newfile = @"\\" + ip + @"\" + dir + file;
if (File.Exists(newfile))
{
File.Copy(newfile, DateTime.Now.ToString("yyyy-MM-dd-hh.mm.ss") + newfile);
File.Delete(newfile);
}
File.Copy(file, newfile);
msg.State = "Y";
return msg;
}
catch (Exception e)
{
msg.State = e.Message;
return msg;
}
}
异常:不支持给定路径的格式。
webservices怎么取的物理路径?怎么处理? --------------------编程问答-------------------- 跟踪看看newfile的值 --------------------编程问答-------------------- 一般情况都是用 Server.MapPath 获取路径 还要判断 权限
补充:.NET技术 , Web Services