我有 win 服务,它必须通过 URL 下载所有 zip 文件(例如 http://download.geonames.org/export/dump/ )但是当我使用 Directory.GetFiles
方法或 DirectoryInfo di = new DirectoryInfo(ConfigurationManager.AppSettings ["GeoFullDataURLPath"])
我得到错误:
URI formats are not supported..
我该如何解决这个问题?
最佳答案
您必须发出 WebRequest。我认为 DirectoryInfo 仅适用于本地驱动器和 SMB 共享。这应该可以解决问题:http://www.csharp-examples.net/download-files/
关于c# - 在 WinService 或 WinForms 应用程序中通过 URL 目录获取文件名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8473344/