Idan Levi
Idan Levi

Reputation: 458

Https communication on localhost in IIS using self-signed certificate

I have 2 sites running on the same machine, a client and an API.
Let's say the computer's IP is 10.10.10.10.
The API has a default page when you browse to it, the rest of the API is under 10.10.10.10/api.

The API has HTTP binding to port 80, and HTTPS binding to port 443.
The client has HTTP binding to port 8080, and HTTPS binding to port 64300.
Both HTTPS bindings use a self signed certificate I created via IIS manager.
Both sites have a HTTP to HTTPS redirect using "URL Rewrite".

When I try to browse either one of the apps, it works fine (gives the warning in the browser that you can skip).

When I do some action in the client which involves a HTTP request to the api using one of the following calls I get an error:
http://localhost/api/someMethod
http://localhost:80/api/someMethod
https://localhost/api/someMethod
https://localhost:443/api/someMethod
https://10.10.10.10/api/someMethod

The exception includes this error: "The remote certificate is invalid according to the validation procedure"

I tried using the method described in this link (add the self-signed certificate to the Trusted Root Certificate Authorities folder) but it won't work.

Help please :D

Upvotes: 0

Views: 2018

Answers (1)

Idan Levi
Idan Levi

Reputation: 458

found the answer.. posting if anyone else will get stuck on it.

It's pretty weird but the only thing that worked was to make the localhost http(s) request using the HOST NAME.

example:

https://the_name_of_the_computer:443/api/someMethod

Upvotes: 0

Related Questions