gpt4 book ai didi

rest - 安卓 :Restful webservice put method showing response with status 405 Method not allowed

转载 作者:行者123 更新时间:2023-12-04 19:47:10 26 4
gpt4 key购买 nike

我正在通过托管在 IIS7 上的 restful web 服务通过 http 获取数据,但是当我尝试放置数据时我遇到了问题

我的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 Method not allowed,谁能告诉我这是什么问题?

最佳答案

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

关于rest - 安卓 :Restful webservice put method showing response with status 405 Method not allowed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22954241/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com