FTP server
This FTP Server is a pure .NET implementation with the following goals:
- Easy to use
- Extensible
- Virtual file system support
- User-defined authentication
Getting started
There is a quickstart tutorial available.
What does it look like?
// Setup dependency injection
var services = new ServiceCollection();
// use %TEMP%/TestFtpServer as root folder
services.Configure<DotNetFileSystemOptions>(opt => opt
.RootPath = Path.Combine(Path.GetTempPath(), "TestFtpServer"));
// Add FTP server services
// DotNetFileSystemProvider = Use the .NET file system functionality
// AnonymousMembershipProvider = allow only anonymous logins
services.AddFtpServer(builder => builder
.UseDotNetFileSystem() // Use the .NET file system functionality
.EnableAnonymousAuthentication()); // allow anonymous logins
// Configure the FTP server
services.Configure<FtpServerOptions>(opt => opt.ServerAddress = "127.0.0.1");
// Build the service provider
using (var serviceProvider = services.BuildServiceProvider())
{
// Initialize the FTP server
var ftpServerHost = serviceProvider.GetRequiredService<IFtpServerHost>();
// Start the FTP server
await ftpServerHost.StartAsync();
Console.WriteLine("Press ENTER/RETURN to close the test application.");
Console.ReadLine();
// Stop the FTP server
await ftpServerHost.StopAsync();
}
ASP.NET Core integration
You can also add the FTP server to your ASP.NET Core application by following the instructions in this quickstart tutorial for ASP.NET Core.
Further information
You find more information on the articles overview.