Полезное

Разные интересные примеры и важные решения

Get response from PostAsJsonAsync

var httpClient = new HttpClient()

var task = httpClient.PostAsJsonAsync(posturi, model)
	.ContinueWith( x => x.Result.Content.ReadAsAsync<bool>().Result);

// 1. GETTING RESPONSE - NOT ASYNC WAY
task.Wait(); //THIS WILL HOLD THE THREAD AND IT WON'T BE ASYNC ANYMORE!
bool response = task.Result

// 2. GETTING RESPONSE - TASK ASYNC WAY (usually used in < .NET 4.5 
task.ContinueWith( x => {
	bool response = x.Result
});

// 3. GETTING RESPONSE - TASK ASYNC WAY (usually used in >= .NET 4.5 
bool response = await task;

WARNING: Unable to download from URI 'https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409' to ''.

Well, I had the same problem. Set my Powershell to TLS 1.2 and it worked for me.

To test this :
1. Open Powershell (As Admin)
2. [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
3. Try it again!

Installing Docker on Windows 2016 Server

To install Docker Enterprise Edition on Windows Server 2016 use the following PowerShell commands:

Install-Module DockerMsftProvider -Force 
Install-Package Docker -ProviderName DockerMsftProvider -Force