且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用C#创建使用本地计算机存储的服务器

更新时间:2022-12-24 22:52:17

这更像是网络共享和文件系统。



1.你需要分享一下用于上传文件的计算机。

2.服务器需要有一个映射到该共享的驱动器。



完成后,您可以轻松使用文件信息类与任何其他目录一样读取内容。



为什么需要数据库?


它没有制作简单的网络服务器非常复杂,请参阅此处也支持发送文件的示例:在不到500行中构建一个小型WebServer [ ^ ]

简单解决方案的缺点是,当暴露于互联网。

I'm a somewhat beginner to intermediate and I wish to create a server that can store files. You upload a file to your computer and then I want to be able to access that file through a server that connects to my computer and shows the files. Could I get any help from an advanced C# programmer that knows how to make online databases?

What I have tried:

I've done some research, but I still can't find a solution... I've tried with python as well, but with no success.

This is more on the lines of network sharing and file systems.

1. You will need a share on your computer for where the files will be "uploaded".
2. The server will need to have a drive mapped to that share.

After this is done, you can easily use the File Info classes to read the contents just like any other directory.

Why do you need a database?


It does not have to be very complicated to make a simple webserver, see example here that also supports sending files: Building a Tiny WebServer in Less than 500 Lines[^]
The downside to simple solutions is that these are not very secure when exposed to the internet.