For some reason, this code fails within a console application, but works when running in LinqPad 5:
private static readonly Uri EndpointUri = new Uri(@"obfuscated");
private static readonly string AuthorizationKey = @"obfuscated";
private static void Main(string[] args)
{
using (var client = new DocumentClient(EndpointUri, AuthorizationKey))
{
var database = client.CreateDatabaseQuery()
.Where(db => db.Id == "FirstDB")
.AsEnumerable()
.SingleOrDefault();
}
}
The error I receive is: Authentication failed because the remote party has closed the transport stream.
I have ensured that the Endpoint and AuthKey are identical through copy/pasting (I merely obfuscated it for this question). My only thoughts are that somehow my organization is giving me issues because the uri is https, but I would expect that if it were the case that LinqPad would run into the same problem.