title: Calling SqlDependency.Start two times continuously, the second time failed?
body: <p>The purpose of calling <code>SqlDependency.Start</code> multiple times is to ensure it's fine before some other action such as creating a new instance of <code>SqlCacheDependency</code> based on a <code>Command</code>. According to Microsoft's document about <code>SqlDependency.Start</code> at here <a href="https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldependency.start(v=vs.110).aspx" rel="nofollow noreferrer">https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldependency.start(v=vs.110).aspx</a> (the Remarks section), looks like calling <code>SqlDependency.Start</code> multiple times is totally fine:</p>
  
  <blockquote>
    <p>Multiple calls with identical parameters (the same connection string and Windows credentials in the calling thread) are valid.</p>
  </blockquote>
  
  <p>But actually it can fail (and really it has never succeeded for me) for the second call, making all next attempts to call <code>SqlDependency.Start</code> fail (silently by returning <code>false</code>, no exception is thrown).</p>
  
  <p>What I did should meet the first restriction (mentioned in the Remarks section in the above link), that is all the calls to <code>SqlDependency.Start</code> have the same parameters (in fact there was just 1 same parameter which is the connection string). It looks just like this:</p>
  
  <pre><code>//at initialization step (such as in `Application_Start()` in ASP.NET MVC)
  SqlDependency.Start(myConnectionString);//this usually returns OK 
  //later at the time before creating an instance of SqlCacheDependency
  //I tried to call the Start method again to ensure everything is ok
  var ok = SqlDependency.Start(myConnectionString);//almost always false
  if(ok){
      //almost never reach here ...
  }
  </code></pre>
  
  <p>So it's really hard to understand about what stated by Microsoft (in the first restriction in the Remarks section), the 2 calls are exactly the same. But with the second call failed, any that same call used after that will still fail (meaning there is not any chance to start it successfully once I attempted to call it more than once). </p>
  
  <p>When I see the log in Sql Server I can see that there are a lot of messages saying something like <em>Cannot find the remote service ... because it does not exist</em></p>
  
  <p>I don't need a solution or work-around this problem, I just need some explanation to why it does not work expectedly like what Microsoft stated, or I misunderstood what stated by Microsoft?</p>