0

クライアントで を使用して MVC3 アプリケーションへの RESTful 呼び出しを行いHammock API、RESTful サービス コードを発行する Silverlight 4.0 アプリケーションがあります。

問題は、がまたはにrequest.Method設定されているかどうかに関係なく、送信される要求は. 私は何を間違っていますか?WebMethod.GetWebMethod.PostPOST

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);
}
4

1 に答える 1

0

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);
}
于 2012-01-24T23:02:41.487 に答える