title: Can't attach to SQL Server to debug SQLCLR Stored Procedure
body: <p>I want to debug a SQLCLR stored procedure in SQL Server. I have been trying to debug an SP in VS2015 Community and in the recently installed VS2017 Community editions without success. I am pretty sure that the problem lies in attaching to SQL Server but as I've done everything I can find mentioned online but to no avail.</p>
  
  <p>When creating the database project in SQL Server Express LocalDB everything works fine. If I change the connection string to use my Developer Edition SQL Server, I then get an error. I have done the following:</p>
  
  <ol>
  <li>I created a new database. I am the only user of the server and it resides on the same desktop machine that I am using for Visual Studio.</li>
  <li><p>In Visual Studio I created a simple database project with a simple method to send some text to the output pipe.</p>
  
  <pre class="lang-cs prettyprint-override"><code>[Microsoft.SqlServer.Server.SqlProcedure]
  public static void mytest ()
  {
      SqlContext.Pipe.Send("in clr Craig1");
  }
  </code></pre></li>
  <li>I edited the Target Connection String in the project properties to connect to the new database and successfully got a connection when pressing the connection button. The connection string used Windows Authentication for me, with the same user as the database owner.</li>
  <li>I built and deployed the solution and checked the SQL Object Explorer to ensure that the SP was deployed. It was.</li>
  <li>I selected the server and, using the right click, selected the "Allow SQL/CLR Debugging". I checked it again to ensure it was actually set.</li>
  <li>I selected the stored procedure and with the right click, selected "Debug Procedure..."</li>
  <li>The debug script was displayed. I stepped to the line to exec the SP and then pressed F11 to step in. At this point I was shown the following:
  <a href="https://i.stack.imgur.com/gVjcK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gVjcK.png" alt="enter image description here"></a></li>
  <li>I pressed the attach and was shown the following error:
  <a href="https://i.stack.imgur.com/r04Jw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/r04Jw.png" alt="enter image description here"></a></li>
  </ol>
  
  <p>Thereafter, the procedure executes and performs the pipe function, but it does not let me do the attachment and the debugging. </p>
  
  <p>Any ideas of what I'm doing wrong?
  Thanks
  Craig</p>