【发布时间】:2015-04-12 22:18:31
【问题描述】:
我希望我的客户端软件使用 http 将文件发送到我的 Linux 服务器。这是我的路线
WebClient client = new WebClient();
client.UploadFile("http://192.168.121.128/musiclocation/", file);
“文件”是我要上传的文件的路径。当我运行我的代码时,我收到错误
System.dll 中出现“System.Net.WebException”类型的未处理异常
附加信息:远程服务器返回错误:(404) Not Found。
我知道我的软件可以找到服务器,因为我的客户端中其他地方的代码运行良好(它不会引发异常)。
MusicPlayer.PlayMp3FromUrl("http://192.168.121.128/musiclocation/" + dataGridView1.Rows[rownumber].Cells["path"].Value.ToString());
我的 apache 设置是默认设置,但 /musiclocation/ 是我的主文件夹中目录的别名。
Alias /musiclocation/ /home/homefolder/MusicStorage/
<Directory /home/homefolder/MusicStorage/>
options +Indexes
order allow,deny
Allow from all
</Directory>
是否需要进一步配置 apache 以允许 WebClient 上传。还是我首先误解了 WebClient 上传的工作原理?我最困惑为什么会收到 404 错误。因为我知道我的服务器是可访问的,所以我预计至少会出现 403 错误。
任何帮助我解决此问题的 cmets 或建议将不胜感激。
【问题讨论】:
标签: c# apache file client-server