title: Can't Authenticate with Local .NET back-end
body: <p>I've followed the guide:</p>
  
  <p><a href="http://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx" rel="noreferrer">Getting Started with Authentication with Mobile Services .NET for Windows Store</a></p>
  
  <p>I'm able to run the service locally as long as I don't need to authenticate the user. I can also authenticate the user if I publish the service to Azure. But I want to be able to test <strong>and</strong> authenticate the user locally. How can this be done?</p>
  
  <p>I'm using Live ID and I have the correct ClientID and ClientSecret set in the Web.config. When I attempt to call LoginAsync from the client the call fails with <strong>The request could not be completed.  (Method Not Allowed)</strong></p>
  
  <p>** <strong>Update 2014-03-20</strong> **</p>
  
  <p>Based on the comments of Carlos and Henrik, I've updated my local service to look <em>exactly</em> like my server instance. I followed Scot Hanselmans <a href="http://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx" rel="noreferrer">excellent guide</a> and now I have my service running locally on port 80 <strong>and</strong> port 443 with a completely valid SSL certificate. It's even running on the exact same <strong><a href="https://xxxx.azure-mabile.net" rel="noreferrer">https://xxxx.azure-mabile.net</a></strong> hostname.</p>
  
  <p>With these changes, there is now no configuration difference whatsoever between running the app against my local machine or running it against Azure. I can go to <strong><a href="https://xxxx.azure-mabile.net" rel="noreferrer">https://xxxx.azure-mabile.net</a></strong> in the browser, get redirected to Live login, sign in, and get redirected back to the service successfully. In the browser it all works. However it <em>still</em> doesn't work in the app.</p>
  
  <p>I attached the debugger, set CLR errors to "break when thrown" and I managed to trap the exception in the service. Here's what I see in the immediate window:</p>
  
  <p><img src="https://i.stack.imgur.com/4XMnQ.png" alt="Immediate Window"></p>
  
  <p>The Response property is not helpful. It does not provide any additional information about the problem.</p>
  
  <p>The only thing that stands out to me is that the app is trying to do a <strong>POST</strong> to <strong>/login/microsoftaccount</strong> while the browser would normally be doing a <strong>GET</strong> at this address (then getting redirected). </p>
  
  <p>** <strong>Update #2 2014-03-20</strong> **</p>
  
  <p>After following Henriks guide for <a href="http://blogs.msdn.com/b/azuremobile/archive/2014/03/14/debugging-net-backend-in-visual-studio.aspx" rel="noreferrer">remote debugging</a> I was able to load symbols and get a <em>tiny</em> bit more information:</p>
  
  <p>"An existing connection was forcibly closed by the remote host"</p>
  
  <p>The error code is 10054 (WSAECONNRESET) Connection reset by peer.</p>
  
  <p>It appears the Live Authentication server may be forcibly terminating the connection, but only when I'm authenticating with the app. Again, authentication within the browser is fine. This, combined with the fact that <strong>/login/microsoftaccount</strong> is a POST from the app seems to suggest there is a problem with the authentication token I'm getting back from LiveClient.LoginAsync. I'll do some more digging...</p>