RestSharp in Mono project (MonoDevelop)

别等时光非礼了梦想. 提交于 2019-12-13 02:36:17

问题


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!


回答1:


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



来源:https://stackoverflow.com/questions/12012963/restsharp-in-mono-project-monodevelop

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!