Android:Restful webservice put方法显示状态为405的响应方法不允许

时间:2014-04-09 06:13:28

标签: rest

我通过http获取数据通过IIS7上托管的restful webservice获取数据但是当我尝试将数据放入时我遇到了问题

我的put代码如下:

public Void put(String url, List<NameValuePair> data)
    {
        String response="";

         HttpPut put = new HttpPut(url);
         String dataString=data.toString();
         HttpClient httpclient = new DefaultHttpClient();

            try {
                StringEntity entity = new StringEntity(dataString, "UTF-8");
                entity.setContentType("x-www-form-urlencoded; charset=UTF-8");
                put.setEntity(entity);

                HttpResponse httpResponse1 = httpclient.execute(put);
                StatusLine statusLine = httpResponse1.getStatusLine();

            }catch (ClientProtocolException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } finally {
                httpclient.getConnectionManager().shutdown();
            }

    }

我得到的回答是405方法不被允许,有人可以告诉我这是什么问题吗?

1 个答案:

答案 0 :(得分:0)

您只需从Windows功能中的IIS菜单中取消选中webdav功能