title: What's causing 500 Internal Server Error due to localhost:9000 being hit in bot framework?
body: <p>Getting this error every time I try to send a message to my bot, or after it responds with 3 messages in a row.</p>
  
  <p>I put a <code>try/catch</code> around the code that's getting the exception (from a call to <code>context.PostAsync</code>) and got this logged in my Application Insights instance:</p>
  
  <pre><code>An error occurred while sending the request.
  Unable to connect to the remote server
  An attempt was made to access a socket in a way forbidden by its access permissions 127.0.0.1:9000
  </code></pre>
  
  <p>Certainly nothing in <em>my</em> code is hitting <code>localhost</code>... anybody else seeing this?</p>
  
  <p>Code that's running when the error occurs:</p>
  
  <pre><code>var j = JToken.Parse(responseJson);
  foreach (var b in j["value"])
  {
      await context.PostAsync($"{b.Value&lt;string&gt;("id")} - {b.Value&lt;string&gt;("name")}");
  }
  </code></pre>
  
  <p>When I run the bot locally and use the Emulator to test I get 3 items output but 500 on the 4th (which isn't malformed in a way such that the json resolution is failing).</p>
  
  <p>When I publish out to Azure App Services, I get 500 error without any output.</p>