Note that there are some explanatory texts on larger screens.

plurals
  1. POStrange behavior with uri and WebClient classes on SSIS package
    text
    copied!<p>I have a quite strange situation.</p> <p>I have this very simple package:</p> <p><img src="https://i.stack.imgur.com/xnf41.jpg" alt="enter image description here"></p> <ul> <li>Task "get list" retrieves a data table from an assembly with one column and a list of URL to be ran into a object variable.</li> <li>The "foreach" loop loops through the object variable and loads the URL into a url string variable</li> <li><p>The "run", calls the url with this code (its 2005 so Im stuck with VB):</p> <pre><code>Dim myURI As New Uri("http://" + Dts.Variables("URL").Value.ToString()) Dim myWebClient As New System.Net.WebClient myWebClient.OpenReadAsync(myURI) </code></pre></li> </ul> <p>the URL being called is internal and just reads the parameters and performs a series of operation which take some time, that's why I used "OpenReadAsync"</p> <p>My problem is: if I have 4 URLs to run, the package runs only 2 of them. The loop lops 4 times, the script is called 4 times (I can see if I debug it), the line <code>myWebClient.OpenReadAsync(myURI)</code> is executed 4 times with 4 different values, but only 2 calls to the URL are made. </p> <p>If I run the package again, the other 2 URLs are now called, which proofs that there isn't anything wrong with the URL and If I call the 4 urls manually on the browser (on 4 tabs for example) one right after another, them all produce the expected result, which proofs that there is nothing wrong with the code that parses the URL.</p> <p>So I'm left with the VB code, its the first time Im using uri and WebClient so I wonder if Im doing something wrong. I also tried to add a 5 seconds sleep between the calls, but no luck.</p> <p>Any help would be appreciated. Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload