我希望我的客戶端軟件使用http將文件發送到我的Linux服務器。這是我行C# - 使用http發送文件到Linux目錄
WebClient client = new WebClient(); client.UploadFile("http://192.168.121.128/musiclocation/", file);
其中「文件」是我上傳的文件的路徑。當我運行我的代碼我收到錯誤
An unhandled exception of type 'System.Net.WebException' occurred in System.dll
Additional information: The remote server returned an error: (404) Not Found.
我知道我的軟件可以找到服務器,因爲我在客戶端工作完全正常其他地方的代碼(它不會拋出異常)。
MusicPlayer.PlayMp3FromUrl("http://192.168.121.128/musiclocation/" + dataGridView1.Rows[rownumber].Cells["path"].Value.ToString());
我的apache設置是默認的,除了/ musiclocation /這是我的home文件夾中的目錄的別名。
Alias /musiclocation/ /home/homefolder/MusicStorage/
<Directory /home/homefolder/MusicStorage/>
options +Indexes
order allow,deny
Allow from all
</Directory>
是否需要進一步配置apache以允許通過WebClient上傳。或者我誤解了WebClient上傳如何工作?我最困惑的是爲什麼我得到一個404錯誤。因爲我知道我的服務器可以訪問,所以我希望至少有403錯誤。
任何意見或建議,以幫助我解決這個問題將不勝感激。