title: Azure - WebSocket upgrade request failed
body: <p>I've tried 2 wcf websocket samples and they both fail with the same error.  I'm hosting a wcf service in IIS that uses websockets.   </p>
  
  <blockquote>
    <p>Unhandled Exception: System.ServiceModel.CommunicationException: A WebSocket error occurred. ---> System.Net.WebSockets.WebSocketException: WebSocket upgrade request failed. The header 'Sec-WebSocket-Protocol' is missing in the response.</p>
  </blockquote>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/hh977020%28v=vs.110%29.aspx" rel="nofollow">1 was the stockquotesample</a> </p>
  
  <p><a href="http://www.codeproject.com/Articles/619343/Using-WebSocket-in-NET-4-5-Part-3" rel="nofollow">The other was this one.</a> </p>
  
  <p>I'm using VS2012 targeting .net 4.5.  </p>
  
  <p>I published the web apps to a new Azure website,  and I was sure to enable websockets on the website or the WCF SVC file would not even load.    </p>
  
  <p>They both fail calling the wcf method.  e.g.  the MS one fails on StartSendingQuotes(). </p>
  
  <pre><code>var context = new InstanceContext(new CallbackHandler());
  var client = new StockQuoteServiceReference.StockQuoteServiceClient(context);
  client.StartSendingQuotes();
  </code></pre>
  
  <p>I'm running the client C# console app in a different Azure virtual machine, so both the client and server are 2012.  </p>
  
  <p><a href="http://blogs.msdn.com/b/windowsazure/archive/2013/11/14/introduction-to-websockets-on-windows-azure-web-sites.aspx" rel="nofollow">I found this recent article</a> and he alludes to the problem i'm having at the bottom and suggests using SSL.   I've tried using wss,  but it give me an error that it expects HTTP and not HTTPS, even though the webserver serves up the service with SSL fine. </p>