I have an application that consists of a intranet web application and intranet web api. Everything works fine locally but after publishing to my test server, the application cannot access the web api. I can access the published web api from Postman or in
the browser but the application receives a certificate validation error. The machine has a certificate installed and I have other web api's running on it and they can be accessed by external servers. Any ideas on how I can solve this?
The machine has a certificate installed and I have other web api's running on it and they can be accessed by external servers.
What is this certificate, is it issued by CA? Besides, could you please show us the certificate validation error message?
Best Regards,
Jiadong Meng
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Before trying to solve a problem, it's best to take few extra minutes to better understand which problem exactly you have...
Edit: you'll perhaps see code that uses this callback to just ignore certificate errors. This is IMO a bad idea. If you really have to it would best to still do a minimal check before rather than blindly accepting all certficates. For now I'm not trying
to solve your issue but rather to understand which exact issue you are running into with this certificate.
Member
1 Points
16 Posts
Can't connect to web api from web application on same machine
Feb 12, 2020 05:52 PM|mrburnttoast79|LINK
I have an application that consists of a intranet web application and intranet web api. Everything works fine locally but after publishing to my test server, the application cannot access the web api. I can access the published web api from Postman or in the browser but the application receives a certificate validation error. The machine has a certificate installed and I have other web api's running on it and they can be accessed by external servers. Any ideas on how I can solve this?
Participant
1320 Points
491 Posts
Re: Can't connect to web api from web application on same machine
Feb 13, 2020 09:40 AM|jiadongm|LINK
Hi mrburnttoast79,
What is this certificate, is it issued by CA? Besides, could you please show us the certificate validation error message?
Best Regards,
Jiadong Meng
All-Star
48510 Points
18072 Posts
Re: Can't connect to web api from web application on same machine
Feb 13, 2020 09:52 AM|PatriceSc|LINK
Hi,
This is an exception? The full details could perhaps help (ie ex.ToString() rather than ex.Message for example). You could also use https://khalidabuhakmeh.com/validating-ssl-certificates-with-dotnet-servicepointmanager to inspect certificate errors.
Before trying to solve a problem, it's best to take few extra minutes to better understand which problem exactly you have...
Edit: you'll perhaps see code that uses this callback to just ignore certificate errors. This is IMO a bad idea. If you really have to it would best to still do a minimal check before rather than blindly accepting all certficates. For now I'm not trying to solve your issue but rather to understand which exact issue you are running into with this certificate.
All-Star
58184 Points
15655 Posts
Re: Can't connect to web api from web application on same machine
Feb 18, 2020 03:10 PM|bruce (sqlwork.com)|LINK
Check that your application is using the dns name defined for the certificate, not localhost or ipaddress.