Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Silverlight 如何使吊床问题成为HTTP GET_Silverlight_Web Services_Rest_Silverlight 4.0_Hammock - Fatal编程技术网

Silverlight 如何使吊床问题成为HTTP GET

Silverlight 如何使吊床问题成为HTTP GET,silverlight,web-services,rest,silverlight-4.0,hammock,Silverlight,Web Services,Rest,Silverlight 4.0,Hammock,我有一个Silverlight 4.0应用程序,它使用客户机上的hammockAPI对MVC3应用程序进行RESTful调用,以发出RESTful服务代码 问题在于,无论请求.Method设置为WebMethod.Get还是WebMethod.Post,发送的请求都是Post。我做错了什么 private IAsyncResult GetServerList() { var callback = new RestCallback((restRequest, restResponse, u

我有一个Silverlight 4.0应用程序,它使用客户机上的
hammockAPI
对MVC3应用程序进行RESTful调用,以发出RESTful服务代码

问题在于,无论
请求.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);
}

尝试在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);
}

什么是重新请求?这是您编写的代码还是某个第三方组件的一部分?RestRequest是Hammock API库的一部分