首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何让Hammock发出HTTP GET

如何让Hammock发出HTTP GET
EN

Stack Overflow用户
提问于 2011-08-11 02:20:22
回答 1查看 363关注 0票数 0

我有一个Silverlight4.0应用程序,它使用客户端上的Hammock API对MVC3应用程序进行RESTful调用,以发出RESTful服务代码。

问题在于,无论request.Method设置为WebMethod.Get还是WebMethod.Post,发送的请求都是一个POST。我做错了什么?

代码语言:javascript
复制
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);
}
EN

回答 1

Stack Overflow用户

发布于 2012-01-25 07:02:41

尝试在RestClient上设置请求类型。

代码语言:javascript
复制
var restClient = new RestClient
        {
            Method = WebMethod.Get
        };

或者从你的例子中:

代码语言:javascript
复制
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);
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7015756

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档