简体   繁体   English

我已从远程计算机加载xml

[英]I have load xml from remote machine

I have url like 我有喜欢的网址

http://steepgraph5-pc/sgs/Client/Innovator.xml

from that url I load Innovator.xml into XmlDocument and get node that contain path like 从该网址,我将Innovator.xml加载到XmlDocument中,并获取包含路径的节点,例如

C:\\Program Files (x86)\\Aras\\Innovator\\InnovatorServerConfig.xml 

now I have to load InnovatorServerConfig.xml into new XmlDocumnet but this path is local to server and i have to load it from client. 现在,我必须将InnovatorServerConfig.xml加载到新的XmlDocumnet中,但是此路径是服务器本地的,我必须从客户端加载它。 I am using c# 我正在使用C#

C# code is like: C#代码类似于:

XmlDocument document = new XmlDocument();
document.Load("http://steepgraph5-pc/sgs/Client/Innovator.xml");
string path=document.SelectSingleNode("/ConfigFilePath/@value").Value;
XmlDocument ServerConfigdocument = new XmlDocument();
ServerConfigdocument.Load(path);

There is no way to convert an arbitrary file system path to a means to access that path from a remote computer. 无法将任意文件系统路径转换为从远程计算机访问该路径的方法。

You need to have some sort of network protocol to access it. 您需要某种网络协议才能访问它。 You appear to have selected HTTP. 您似乎选择了HTTP。

Given that you are using HTTP, you have to: 鉴于您正在使用HTTP,因此您必须:

  • Be wanting to access a file that the server actually makes available 想要访问服务器实际可用的文件
  • Know how the server maps its Document Root onto the file system 知道服务器如何将其文档根映射到文件系统

Then you can convert the file path to a URL. 然后,您可以将文件路径转换为URL。

This isn't a sensible thing to do on the client. 在客户端上这样做不是明智的选择。 It would make more sense for the server to rewrite the XML and replace the local path with an HTTP URI. 服务器重写XML并将本地路径替换为HTTP URI更有意义。

Innovator server config is just a file loaded by the Innovator server side when it starts up. Innovator服务器配置只是启动时由Innovator服务器端加载的文件。

If you edit it it will have no effect until you restart the IIS webserver. 如果您对其进行编辑,则在重新启动IIS Web服务器之前它不会起作用。

I'd recommend just remote desktop to the server, edit the file and restart the webserver. 我建议仅将远程桌面连接到服务器,编辑文件并重新启动Web服务器。

If you wish to to this remotely, then you can make the Innovator root folder accessible via WEBDAV. 如果您希望远程访问此目录,则可以通过WEBDAV访问Innovator根文件夹。 This can be mounted or browsed by any remote machine as though it is a local disk. 任何远程计算机都可以将其安装或浏览,就像它是本地磁盘一样。 Then after editing, use the remote management capability of IIS to restart the server. 然后,在编辑后,使用IIS的远程管理功能来重新启动服务器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM