c# - Add foreach loop around Webclient resulting in error -
After adding a foreach loop around a webclant function, it closes the following error
Foreach (string rssFeed in lstRSSFeeds) {// Our Web Downloader WebClient Downloader = New WebClient (); // To download our web address, see Urikind. Absolute Uri Uri = New Uri (RSSFid, Uricand.Assolute); // We need to wait for the file to be completely downloaded, so hook the DownloadComplete Event Downloader. Download DownloadStringCompleted + = New DownloadStringCompletedEventHandler (FileDownloadComplete); // Download Downloader Start. DownloadloadingSync (Yuri); } Public Zero FileDownloadComplete (Object Sender, DownloadStringCompletedEventArgs E) {// E. The result will include file byte for byte // your settings XmlReaderSettings Settings = New XmlReaderSettings (); Settings.DtdProcessing = DtdProcessing.Ignore; // Create a memory stream for us to use by downloading the file memorystream ms = new memorystream (systemtext.keyword.utf 8.gatebayit (e.zip ;? "" ")); Create your reader from the stream of // bytes XmlReader Reader = XmlReader.Create (MS, Settings); Syndication feed = syndication feed Load (reader); / / Whatever you want with the reader / ........ reader.Close (); }
causes the error:
The first chance of type 'system.IO.FileNotFoundException' occurred in mscorlib.ni.dll
Additional information: The file or the assembly could not be loaded as a system file from System.Windows.debug.resources, version = 2.0.6.0, culture = en-US, PublicKeyToken = 7cec85d7bea7798e 'or its dependencies Can not specify.
You use either the current synchronous and event-based model and method.
or async await
, so for the return methods, the keyword wait
code> Task < T & gt; :
Wait for the downloader. Downloadloading ASINSCNC (Yuri);
Here's some way to get to know:
- Start this way.
- View the posts posted by and.
Comments
Post a Comment