RestSharp无效的URI:URI方案无效

时间:2011-08-08 17:32:07

标签: c# windows-phone restsharp

我正试图让我的脑袋围绕着针对Windows Phone 7的restsharp。我正在尝试使用POST方法将一些数据提供给服务器,但是当它到达client.executeasync行时,它会因错误而崩溃“无效的URI:URI方案无效。”我错过了什么?

        var client = new RestSharp.RestClient("10.0.1.20:8085");
        var request = new RestSharp.RestRequest("/test", RestSharp.Method.POST);

        request.AddParameter("param1", "value1", RestSharp.ParameterType.GetOrPost);
        request.AddParameter("param2", "value2", RestSharp.ParameterType.GetOrPost);
        request.AddParameter("param3", "value3", RestSharp.ParameterType.GetOrPost);
        request.AddParameter("param4", "value4", RestSharp.ParameterType.GetOrPost);

        client.ExecuteAsync(request, (response) =>
        {
            var auth = response.Content;
        });

1 个答案:

答案 0 :(得分:4)

将第一行更改为

var client = new RestSharp.RestClient("http://10.0.1.20:8085");