This project is read-only.

HDInsightClient > not working in Web Application


(possibly related to issue reported in: )

Using HDInsight .NET client >= in a web application (ASP.NET MVC 5) causes operations on the HDInsightClient object to never return. eg:
            var client = HDInsightClient.Connect(new HDInsightAccessTokenCredential(Guid.Parse("eb1a85f8-09c6-4c54-ba20-5a6f264744c8"), "eyJ0eXAiOi..."));
            // Next call (or any call on the client object) never returns
            var locations = client.ListAvailableLocations();
The issue is reproducible using library version >= and consistently does NOT appear in versions prior to that. I have also confirmed that the authentication method (certificate or bearer token) does not affect this behavior. The call consistently works correctly in any environment other than a web application.

From a Fiddler trace, I can see that the request is issued to The host; asks for a client certificate during the TLS negotiation, but even if no certificate is used a valid response is received. The response does not seem to be processed by the HDInsightClient library and therefore the call never returns.


Lesmian wrote Oct 30, 2014 at 10:50 PM

Same issue here. I tried different project from classic ASP, Azure Websites and Console App and HDInsight .NET SDK works only on console app. Like jamesbak I checked response in fiddler and it looks good, but still website hangs after call to client method (it never returns). I checked different certificates from Azure Public Profile to self-signed and all works well on console and don't work on website project. Whats more confusing is that i checked website management api with the same certificate as in hd insight api and it works well on website project.

dmitriychernenko wrote Dec 5, 2014 at 5:24 PM

I've faced with the same problem, you can use simple workaround, just wrap all hdinsight calls into Task.Run(...).Result for synchronous calls and await Task.Run(...) for asynchronous, like this:
var locations = Task.Run(() => client.ListAvailableLocations()).Result;

rhizohm wrote Jan 23, 2015 at 10:16 PM

@dmitriychernenko - THANK YOU! This problem has plagued me for a long time and I tried all kinds of different signatures that didn't solve the problem -- which I believe is a fundamental problem in the SDK with how the async and await patterns are implemented. There nested callbacks and it results in a deadlock, but your workaround contains the background threads so they don't lose affinity.