M.Sharma
M.Sharma

Reputation: 289

ASP.NET Core 3 Web Is Not Able To Connect ASP.Net Core 3 Web API on same server

I have a web application that has built on ASP.NET CORE 3. This web application uses asp.net core 3 web api. Everything works fine. But problem starts when I move them to the staging server. Web Application was not able to connect web api. They both hosted on same machine but have different port.

For example :

Web Application URL http://52.X.X.X:94/MyWeb

Web API URL http://52.X.X.X:91/MyWebAPI

I get following error

System.Net.Http.HttpRequestException: 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.

I have enabled CORS in web API.

However, If I move Web Api to Port 80 (http://52.X.X.X:80/MyWebApi ) then everything is working.

On my local IIS they both are working.On local IIS they were published on same port ( 94 and 91 respectively)

Can anyone tell what I am missing?

Upvotes: 1

Views: 632

Answers (1)

Mehrdad
Mehrdad

Reputation: 1731

do you have appropriate web.config on server? compare local web.config with server web.config. maybe you missed some part like kestler or something else.

if it's alright, then check your webapi with postman, maybe webapi didn't published correctly.

Upvotes: 0

Related Questions