我有一个Silverlight4.0应用程序,它使用客户端上的Hammock API对MVC3应用程序进行RESTful调用,以发出RESTful服务代码。
问题在于,无论request.Method设置为WebMethod.Get还是WebMethod.Post,发送的请求都是一个POST。我做错了什么?
private IAsyncResult GetServerList()
{
var callback = new RestCallback((restRequest, restResponse, userState) =>
{
// There is some working callback code here. Excluded for clarity.
}
);
var request = new RestRequest();
request.Method = WebMethod.Get;
request.Path = "ServerList";
return _restClient.BeginRequest(request, callback);
}发布于 2012-01-25 07:02:41
尝试在RestClient上设置请求类型。
var restClient = new RestClient
{
Method = WebMethod.Get
};或者从你的例子中:
private IAsyncResult GetServerList()
{
var callback = new RestCallback((restRequest, restResponse, userState) =>
{
// There is some working callback code here. Excluded for clarity.
}
);
var request = new RestRequest();
request.Path = "ServerList";
_restClient.Method = WebMethod.Get;
return _restClient.BeginRequest(request, callback);
}https://stackoverflow.com/questions/7015756
复制相似问题