Bug 2942 - SocketException when calling a web service
Summary: SocketException when calling a web service
Alias: None
Product: Android
Classification: Xamarin
Component: Mono runtime / AOT Compiler ()
Version: 4.0
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2012-01-17 14:41 UTC by James Clancey
Modified: 2012-01-17 15:26 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Testcase (24.23 KB, application/zip)
2012-01-17 14:41 UTC, James Clancey

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description James Clancey 2012-01-17 14:41:05 UTC
Created attachment 1215 [details]

I have a problem on creating a web service that can be consumed by mono for android. I did read the documentation regarding consuming the web service and have tried the http://soatest.parasoft.com/calculator.wsdl and it ran successfully.But when I tried to use asmx in my local machine the application keep spitting out exception when trying to access the web service.Is there any idea to work around this? I attached my service code. I deployed this service code using the latest IIS version and the app pool version is 2.0. 

Unhandled Exception:

[ERROR] FATAL UNHANDLED EXCEPTION: System.Net.WebException: Error: ConnectFailure (Connection refused) ---> System.Net.Sockets.SocketException: Connection refused
  at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x00102] in /home/jon/Development/xamarin/mono/mcs/class/System/System.Net.Sockets/Socket_2_1.cs:1251 
  at System.Net.WebConnection.Connect (System.Net.HttpWebRequest request) [0x00180] in /home/jon/Development/xamarin/mono/mcs/class/System/System.Net/WebConnection.cs:191 
  --- End of inner exception stack trace ---
  at System.Net.HttpWebRequest.EndGetRequestStream (IAsyncResult asyncResult) [0x00043] in /home/jon/Development/xamarin/mono/mcs/class/System/System.Net/HttpWebRequest.cs:727 
  at System.Net.HttpWebRequest.GetRequestStream () [0x00057] in /home/jon/Development/xamarin/mono/mcs/class/System/System.Net/HttpWebRequest.cs:745 
  at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke (System.String method_name, System.Object[] parameters) [0x00069] in /home/jon/Development/xamarin/mono/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHttpClientProtocol.cs:367 
In mgmain JNI_OnLoad
The program 'Mono' has exited with code 255 (0xff).
Comment 1 Gonzalo Paniagua Javier 2012-01-17 15:26:03 UTC
Unless you are running the web server on the device, you need to set: service.Url = "http://blahbleh/Blih.asmx";

otherwise, the default Url is http://localhost/AndroidWebService/AndroidService.asmx