REST - HttpClient - Server, C#, http all ok, https not ok

Markus Freitag 3,786 Reputation points

@Lan Huang-MSFT,

Sorry, I can't reproduce your issue. Maybe you could follow SurferOnWww's advice: use Fiddler or equivalent to see what's going on between client and server.

I have found the cause, it is because of the security.

What can be the solution?

It would be great if I could get the server on another PC.

See my link. Do you know a good way, instruction.

How do you solve the authentication? What are the options?

using (var client = new HttpClient())
	client.BaseAddress = new Uri("http://localhost:55893/");

	//client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
	//string authorization = $"{""}:{""}";
	//client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", "");                   

	//GET Method
	//HttpResponseMessage response = await client.GetAsync("api/valuesGET");

    //string urlParameters = $@"Api/ValuesGET";
	//urlParameters = $@"Api/ValuesGET?status=2";

	HttpResponseMessage response = client.GetAsync("Api/valuesGET").Result;

	HttpResponseMessage response2 = await client.GetAsync("Api/valuesGET");

	if (response.IsSuccessStatusCode)
A set of technologies in the .NET Framework for building web applications and XML web services.
3,326 questions
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,415 questions
{count} votes