[Mono-list] Problem trying to download a file with WebClient

Rafael "fumasa" Giorgetti fumasa at gmail.com
Fri Jun 16 19:37:58 EDT 2006


I try download data using 3 different methods/classes and all time I
got the same Unhandled Exception...

My code:
************************
//address = "https://mail.google.com/gmail/feed/atom";
WebClient client = new WebClient();
Stream pageStream = client.OpenRead(address);
********* I have try too with that code:
ServicePointManager.CertificatePolicy = new DummyCertificatePolicy();
HttpWebRequest myReq = (HttpWebRequest) HttpWebRequest.Create(address);
myReq.PreAuthenticate = true;			
HttpWebResponse response = (HttpWebResponse)myReq.GetResponse();
Stream pageStream = response.GetResponseStream();
********* and that code:
WebRequest wr = WebRequest.Create (address);
Stream pageStream = wr.GetResponse ().GetResponseStream ();
************************

and the Exception always was...

++++++++++++++++++
Unhandled Exception: System.TypeInitializationException: An exception
was thrown by the type initializer for System.Net.ServicePointManager
---> System.Configuration.ConfigurationException: Error reading
/etc/mono/1.0/machine.config () --->
System.Threading.ThreadAbortException: Thread was being aborted
in <0x00000> <unknown method>
in (wrapper managed-to-native)
System.Object:__icall_wrapper_mono_thread_interruption_checkpoint ()
in (wrapper managed-to-native) System.String:.ctor (char[],int,int)
in [0x000bb] (at
/build/buildd/mono-1.1.13.6/mcs/class/System.XML/System.Xml/NameTable.cs:88)
System.Xml.NameTable:Add (System.Char[] key, Int32 start, Int32 len)
in [0x00138] (at
/build/buildd/mono-1.1.13.6/mcs/class/System.XML/System.Xml/XmlTextReader.cs:2578)
System.Xml.XmlTextReader:ReadName (System.String prefix, System.String
localName)
in [0x0004d] (at
/build/buildd/mono-1.1.13.6/mcs/class/System.XML/System.Xml/XmlTextReader.cs:1276)
System.Xml.XmlTextReader:ReadStartTag ()
in [0x0013f] (at
/build/buildd/mono-1.1.13.6/mcs/class/System.XML/System.Xml/XmlTextReader.cs:1214)
System.Xml.XmlTextReader:ReadContent ()
in [0x00113] (at
/build/buildd/mono-1.1.13.6/mcs/class/System.XML/System.Xml/XmlTextReader.cs:590)
System.Xml.XmlTextReader:Read ()
in [0x0021a] (at
/build/buildd/mono-1.1.13.6/mcs/class/System.XML/System.Xml/XmlWriter.cs:533)
System.Xml.XmlWriter:WriteNode (System.Xml.XmlReader reader, Boolean
defattr)
in [0x00111] (at
/build/buildd/mono-1.1.13.6/mcs/class/System.XML/System.Xml/XmlWriter.cs:487)
System.Xml.XmlWriter:WriteNode (System.Xml.XmlReader reader, Boolean
defattr)
in [0x0002f] (at
/build/buildd/mono-1.1.13.6/mcs/class/System.XML/System.Xml/XmlReader.cs:697)
System.Xml.XmlReader:ReadOuterXmlInternal ()
in [0x00001] (at
/build/buildd/mono-1.1.13.6/mcs/class/System.XML/System.Xml/XmlReader.cs:658)
System.Xml.XmlReader:ReadOuterXml ()
in [0x0001f] (at
/build/buildd/mono-1.1.13.6/mcs/class/System/System.Configuration/ConfigurationSettings.cs:618)
System.Configuration.ConfigurationData:StorePending (System.String
name, System.Xml.XmlTextReader reader)
in [0x00073] (at
/build/buildd/mono-1.1.13.6/mcs/class/System/System.Configuration/ConfigurationSettings.cs:634)
System.Configuration.ConfigurationData:ReadConfigFile
(System.Xml.XmlTextReader reader)
in [0x00035] (at
/build/buildd/mono-1.1.13.6/mcs/class/System/System.Configuration/ConfigurationSettings.cs:268)
System.Configuration.ConfigurationData:Load (System.String
fileName)--- End of inner exception stack trace ---

in [0x00059] (at
/build/buildd/mono-1.1.13.6/mcs/class/System/System.Configuration/ConfigurationSettings.cs:272)
System.Configuration.ConfigurationData:Load (System.String fileName)
in [0x00025] (at
/build/buildd/mono-1.1.13.6/mcs/class/System/System.Configuration/ConfigurationSettings.cs:161)
System.Configuration.DefaultConfig:Init ()
in [0x00001] (at
/build/buildd/mono-1.1.13.6/mcs/class/System/System.Configuration/ConfigurationSettings.cs:149)
System.Configuration.DefaultConfig:GetConfig (System.String
sectionName)
in [0x00006] (at
/build/buildd/mono-1.1.13.6/mcs/class/System/System.Configuration/ConfigurationSettings.cs:63)
System.Configuration.ConfigurationSettings:GetConfig (System.String
sectionName)
in [0x00036] (at
/build/buildd/mono-1.1.13.6/mcs/class/System/System.Net/ServicePointManager.cs:88)
System.Net.ServicePointManager:.cctor ()--- End of inner exception
stack trace ---

in <0x00000> <unknown method>
in [0x00005] (at /home/fumasa/Projects/GmailAlert/GmailAtom.cs:21)
GmailAlert.AtomReader:ReadMails ()
in [0x00006] (at /home/fumasa/Projects/GmailAlert/GmailTray.cs:82)
GmailAlert.GmailAlertTray:ReadMails (System.Object state)
in (wrapper delegate-invoke)
System.MulticastDelegate:invoke_void_object (object)
in [0x0007c] (at
/build/buildd/mono-1.1.13.6/mcs/class/corlib/System.Threading/Timer.cs:87)
System.Threading.Timer+Runner:WaitForDueTime ()
in [0x0002a] (at
/build/buildd/mono-1.1.13.6/mcs/class/corlib/System.Threading/Timer.cs:118)
System.Threading.Timer+Runner:Start ()
in (wrapper delegate-invoke) System.MulticastDelegate:invoke_void ()
++++++++++++++++++

I don't have ideia what is wrong... some clue anybody?

[]'s

Rafael 'fumasa' Giorgetti


More information about the Mono-list mailing list