如何从一个Windows服务使用C#访问Linux的目录/文件 [英] How to access Linux directories/files from a Windows Service using C#

查看:838
本文介绍了如何从一个Windows服务使用C#访问Linux的目录/文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个需要访问一台Linux计算机获得在特定目录中的文件列表的C#Windows服务。什么.NET 3.5SP1方法会使用一次,可以让我做到这一点?

I have a C# Windows Service that needs to access to a Linux computer to get a list of files in a particular directory. What .NET 3.5SP1 method would one use that allows me to do this?

感谢。

推荐答案

您必须创建一个桑巴(SMB),或在Linux中是从运行应用程序的Windows计算机访问NFS共享。

You'll have to create a Samba (SMB) or NFS share on the Linux box that is accessible from the Windows machine that is running your application.

您可以再使用的标准工具与文件/目录在.NET中工作的文件进行操作。

You can then use the standard tools for working with files/directories in .NET to work with the files.

正如评论,你也可以使用标准的FTP库,这需要你的Linux机器上配置的FTP服务器。 SFTP也是一个选择......但需要在.NET侧第三方库。

As mentioned in comments, you could also use the standard FTP libraries which would require configuring an FTP server on your Linux machine. SFTP is also an option...but would require a third party library on the .NET side.

这篇关于如何从一个Windows服务使用C#访问Linux的目录/文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆