如何使用C#创建使用本地计算机存储的服务器 [英] How do I create a server with C# that uses my local computer storage

查看:110
本文介绍了如何使用C#创建使用本地计算机存储的服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是初学者,我希望创建一个可以存储文件的服务器。您将文件上传到您的计算机,然后我希望能够通过连接到我的计算机的服务器访问该文件并显示文件。我可以从一位知道如何制作在线数据库的高级C#程序员那里获得任何帮助吗?



我尝试了什么:



我做了一些研究,但我仍然无法找到解决方案......我也尝试过使用python,但没有成功。

解决方案

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



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.


这篇关于如何使用C#创建使用本地计算机存储的服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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