Note that there are some explanatory texts on larger screens.

plurals
  1. POWebService Calls Database Twice
    primarykey
    data
    text
    <p>I have a very simple web service function that pulls data from the database and returns it to the user. However I've discovered recently (via logging on the database end) that the call is being performed TWICE. I've narrowed it down to the webservice that's causing the problem... if I open the service through the browser on localhost and then execute it directly, the SQL log shows it has having run twice within about 1/100th of a second.</p> <p>I'm including my code for guidance. Built in VS2008.</p> <pre><code>&lt;WebMethod()&gt; _ Public Function MY_DATABASE_QUERY() As DataSet Dim DS As New DataSet Dim DA As New SqlDataAdapter Dim Cmd As New SqlCommand With Cmd .Connection = Connection() .CommandType = CommandType.StoredProcedure .CommandText = "SOME_STORED_PROCEDURE" .Connection.Open() .ExecuteReader() .Connection.Close() DA.SelectCommand = Cmd DA.Fill(DS) End With Return DS End Function </code></pre> <p>The Connection() function simply pulls the encrypted connection string from web.config, decrypts it, and returns the object:</p> <pre><code>Public Function Connection() As SqlConnection Dim R As New Rijndael Return New SqlConnection(R.DecryptString128Bit(System.Configuration.ConfigurationManager.ConnectionStrings("ConnString").ToString, "S0ME_HA$H_C0D3")) End Function </code></pre> <p>...and that's basically it. It's about as straightforward as you can get.</p> <p>With this in mind, does anybody have any idea why it's behaving as it is, and how I can prevent this in the future? It's no big deal for this query, but it could be a very big deal if it's doing it on (for example) a purchase or a payment.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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