I have this scenario: I have an ASP.NET API which is deployed on IIS under the default web site. I have added the API by right click on default web site -> add application. API is working fine and I am able to use it.

I am using this API in my ASP.NET MVC project. On local, everything is working fine. Then I deployed it to the same IIS where the API is deployed. I have created a new application under the same default web site. Now ASP.NET MVC is unable to communicate with the API.

I'm getting errors like this:

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

Then I changed the API hostname reference in the ASP.NET MVC app to IP, localhost. In that case I am getting this response:

The SSL connection could not be established, see inner exception. System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure

Am I missing anything? How to solve this?

Thanks

2 Replies 2

You will have to show IIS configuration as part of the question, like what kind of certificate you are using in that HTTPS site binding. In general, you should test your web apps using HTTP site binding which is much easier to set up. But if you prefer HTTPS, then you must configure IIS properly as well as your web app (like letting them accept self-signed certificates).

You can try to make a Virtual Directory under the main site (for example called API) and then put the API part in that Virtual Directory.

You can not put two different applications in the root of one Web Site because each application need it's startup to run, and the web app can run only one startup. If you use a Virtual Directory then what you put there should run as a separate application.

This also means that you have to have a separate config (appsettings) for the virtual directory.

Your Reply

By clicking “Post Your Reply”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.