405:WebClient.FileUpload方法中不允许的方法

时间:2016-02-02 10:30:14

标签: c# iis file-upload

我正在尝试使用以下代码将Voices目录中的文件上传到IIS网站 -

System.Net.WebClient webClient = new System.Net.WebClient();
string sourceFilePath = e.FullPath;
string webAddress = "http://111.222.333.444:1012/Voices/";
string destinationFilePath = webAddress + e.Name;
webClient.UploadFile(destinationFilePath, "PUT", sourceFilePath);
webClient.Dispose();

它给了我一个例外405: Method Not Allowed。此代码在WinForm应用程序上运行。

服务器端是否有配置问题?

1 个答案:

答案 0 :(得分:0)

您应该从

中的模块和处理程序中删除WebDAV
SELECT ... FROM t1 
   LEFT JOIN (SELECT ... FROM a LEFT JOIN b ON...) t2 
      ON 
        t2.id = t1.c2 OR 
        t2.id = t1.c3 OR 
        t2.id = t1.c4 OR
        t2.id = t1.cn

如果这还不够,您可以在microsoft http://www.asp.net/web-api/overview/testing-and-debugging/troubleshooting-http-405-errors-after-publishing-web-api-applications

中看到此链接