Mono项目中的RestSharp(MonoDevelop) [英] RestSharp in Mono project (MonoDevelop)

查看:71
本文介绍了Mono项目中的RestSharp(MonoDevelop)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一些Mono项目(Mono 2.10.8),并尝试使用RestSharp.正如我在RestSharp页面上看到的那样,它支持Mono.

我正在尝试运行以下简单代码:

var client = new RestClient("http://www.go2board.com");
var request = new RestRequest();
var result = client.Execute(request);

但是每次我在MonoDevelop IDE中选择Mono 2.10.8运行时时,都会出现以下错误

{System.Net.WebException: The request timed out   at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00046] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.8\mcs\class\System\System.Net\HttpWebRequest.cs:824    at System.Net.HttpWebRequest.GetResponse () [0x0000e] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.8\mcs\class\System\System.Net\HttpWebRequest.cs:836    at RestSharp.Http.GetRawResponse (System.Net.HttpWebRequest request) [0x00000] in C:\Users\Renato\Desktop\restsharp-RestSharp-8763a56\restsharp-RestSharp-8763a56\RestSharp\Http.Sync.cs:142 }

如果我在MonoDevelop中切换到.NET运行时,则一切正常,并且得到预期的结果.

我还下载了RestSharp源代码,再次将其编译为Mono 2.10.8,然后再次尝试,但没有成功.

那么,我可以在Mono应用程序中使用RestSharp吗,如果可以,怎么办?我想念什么吗?有步骤吗?

此外,我通过Mono MOMA分析仪分析了RestSharp.dll,并获得了肯定的结果,这意味着我可以在Mono上使用RestSharp.

提前谢谢!

解决方案

因此,正如rjovic确认的那样,这可能是 Mono for Windows 中的错误. >

真的,仅建议将Mono用于非Windows平台.这是有道理的,特别是因为对于Windows平台,您始终拥有MS.NET;)

I'm doing some Mono project (Mono 2.10.8) and trying to use RestSharp. As I saw on RestSharp page it support Mono.

I'm trying to run following simple code :

var client = new RestClient("http://www.go2board.com");
var request = new RestRequest();
var result = client.Execute(request);

But everytime when I choose Mono 2.10.8 runtime in MonoDevelop IDE I'm getting following error

{System.Net.WebException: The request timed out   at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00046] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.8\mcs\class\System\System.Net\HttpWebRequest.cs:824    at System.Net.HttpWebRequest.GetResponse () [0x0000e] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.8\mcs\class\System\System.Net\HttpWebRequest.cs:836    at RestSharp.Http.GetRawResponse (System.Net.HttpWebRequest request) [0x00000] in C:\Users\Renato\Desktop\restsharp-RestSharp-8763a56\restsharp-RestSharp-8763a56\RestSharp\Http.Sync.cs:142 }

If I switch to .NET runtime in MonoDevelop, everything works fine and I get result as expected.

I also download the RestSharp source code, compile it agains Mono 2.10.8 and tried again, but with no success.

So, can I use RestSharp in my Mono application, and if I can, how? Am I missing something? Some step?

Also, I analyzed RestSharp.dll through Mono MOMA analyzer and I got positive result, which means that I can use RestSharp on Mono.

Thank you in advance!

解决方案

So, as confirmed by rjovic, this may be a bug in Mono for Windows.

Really, Mono is recommended only for non-Windows platforms. It makes sense, especially because for Windows platforms you always have MS.NET ;)

这篇关于Mono项目中的RestSharp(MonoDevelop)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆