Reputation: 1122
When I have an ASP.NET web app with some API controllers that has a route /api
for example, I can publish the app to Azure Web App and use the api by accessing someproject.azurewebsites.net/api/controller
.
However, when I separate a web API part from the web app project, I have to publish the web API project to new domain like someapiproject.azurewebsites.net
. I want to integrate the web API project to the web app just as I did with one combined project.
Is this possible?
Upvotes: 2
Views: 511
Reputation: 7686
Martin Brandl's answer is spot on. But if you want to go the poor man's route, you can create a reverse proxy from your ASP.NET Web App and map app traffic from someproject.azurewebsites.net/apiV2 to someapiproject.azurewebsites.net. This is not a HTTP 30x redirect - the URL will not change for users hitting your /apiV2. I've personally used this approach because the Azure API Management service can get a little pricey. If you don't need the sexy features like throttling, this can be a good way to go.
Upvotes: 0
Reputation: 58931
If you want to combine multiple APIs, you should take a look at Azure API Management. I doubt that you can publish multiple APIs into a single Web API since both requires a startup where you configure the host.
What you can do to cleanup your code is to outsource the controller into different assemblies and configure them in the middleware. Here is an example.
Upvotes: 1