P
P
polyakovyevgeniy2016-06-13 12:49:03
ASP.NET
polyakovyevgeniy, 2016-06-13 12:49:03

How to communicate between an ASP.NET WEB API running on a separate URL with an ASP.NET client?

I have an application with ASP.NET Web API, it accepts HTTP requests, it runs on a specific address. I need to access it from a client site also written in ASP.NET. When creating an application in VIsual Studio, a WebApI project is created in the same project as the application, and it is accessed simply by calling the HTTP verb on the local address. And if my WEB API is on the Internet, how can I access it? I guess there should probably be an entry in the configuration to refer to the base address, and then the necessary verbs and controller names will already be used in the application. If the address changes, you can also change the line with the address.
Is this true? Or are there better ways? And how is it done in general? Or is it impossible to do it separately and access WebAPi from the Internet?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
#
#algooptimize #bottize, 2016-06-13
@polyakovyevgeniy

I see two options. Either the client itself accesses webapi , or the second service accesses webapi
What will be done with asp.net , js ajax- it doesn't matter. An http request is made from the required service.
If both the webapi service and the aps.net service are on the same host, then perhaps the client should call webapi directly.
In short, do what feels right for you.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question