Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recommended way to host a WebApi in Azure

I wanted to host my WebApi project on azure. But I am not getting sure which way should i use to run it on azure. Like there are Websites, Cloud Services that contain Web role and Worker role. Then which one should i choose. If cloud service is the option then which one out of Web role and worker role is good?

Any help is appreciated.

like image 425
loop Avatar asked Jul 01 '14 08:07

loop


People also ask

Which of the following Azure App Service helps you to host the REST API?

Azure App Service provides a highly scalable, self-patching web hosting service. In addition, App Service has built-in support for Cross-Origin Resource Sharing (CORS) for RESTful APIs.


2 Answers

For hosting a simple web API (that you can scale according to usage, etc.) you'll want to use Websites. Assuming you're not looking for more complex / heavy-weight features (network configuration, more complex architectures e.g. offloading background processing different instances via queueing mechanisms, RDP into the host machine, etc.), then Websites are becoming the de-facto way to host websites on Azure.

The following page from the Azure documentation will give you a full feature comparison between the two: http://azure.microsoft.com/en-us/documentation/articles/choose-web-site-cloud-service-vm/, but in short, if you simply have a web API project in VS that you want to host in Azure without worrying about the underlying infrastructure, then use Websites.

like image 112
mpd106 Avatar answered Oct 15 '22 08:10

mpd106


If you only want to host a Headless (No Web Interface) Web API, I recommend you using Azure Web Service - Web Role.

For Worker Role, it is like a console application that you want to use it to process background task. Normally, we use it to process from Message Queue (Azure Service Bus - Queue).

Azure create a Optimize VM to run those two type of Roles with no unnecessary junks. So you will get the most of it.

However, I still suggest you to read more detail document from azure website to see what environment which is best fit for your long term plan.

like image 42
Tola Ch. Avatar answered Oct 15 '22 10:10

Tola Ch.