SignalR on Azure: Web or Worker Role? - azure

I need to deploy my SignalR back-end application on Azure, without any dependency to ASP.NET (I use a console app for testing purposes).
So, I need an Azure Cloud Service, and I don't know if I should go for a worker role or a web role. According to this link, I successfully created a worker role hosting my SignalR app, but I want to know if this is the best way to go.

Related

Why should I prefer Azure App Service over .NET REST Web API?

Why should I use Azure App Service and not just implement a common .NET RESTful Web API backend?
What's the explicit benefit of this service compared to a common .NET RESTful Web API backend hosted on Azure?
An Azure App Service is a place to host your web application or API. Normally when you have a .NET web API you host it behind IIS or something on a virtual machine.
Azure helps you with these common scenarios wit Platform as a Service (PaaS). An App Service completely abstracts the operating system and the way you host your web application.
App Service can host web apps both on Windows and Linux. You can use all kinds of frameworks such as PHP, .NET or Java. You can even host containers without worrying about the host.
A good sample to start with hosting your .NET Web App on Azure App Services can be found here: Quickstart: Create an ASP.NET Core web app in Azure
Yes, there is a huge difference between Azure App Service and .Net REST WebAPI backend on Azure.
Hosting on Azure can be done using two ways
Create your own VM, then install IIS and do all the required stuff
Use AppService Plan
AppService Plan allows you to leverage the powerful functionality of Azure. Here a separate VM is not assigned to you. Azure App service can scale automatically depending upon the Scaling rule which is not present in restful API hosted on Azure VM.
My question blatantly was a stupid Newbie question, and as such, I'm afraid it is non-sense, which I now know by the answers you've given.
I'm currently reading the book "Azure and Xamarin Forms" to learn Xamarin and Azure. Apparently it's outdated. It suggests to "create a Mobile App on Azure". From the book that Mobile App is just a plain App Service running a RESTful Web API with EF, but utilizing completely different namespaces to do so.
My question targeted towards these other namespaces. I didn't see a reason for them.
Apparently, Microsoft noticed the same. There is no "Mobile App" available in the Azure Marketplace anymore.
Azure App Service is a PaaS solution from Microsoft hosted on Azure. You can think of Azure App Service as some sort of "Micrsoft Heroku", because they work on a similar fashion. For many REST Projects, it can save you hours, if not DAYS of development. It has automatic TLS like heroku, but it is hosted on Azure instead of AWS and it can integrate very well with your existing Azure resources. One common pattern is to host the REST API on App Service and use a database service from Azure such as Azure SQL or Cosmos DB (which is a NoSQL service that, from the point of view of your app, it operates as MongoDB, but can be configured to behave as other DBMS).

Azure WebJob In its own AppService or in an AppService with Api

I have an AppService which hosts an Api. I also have two WebJobs. My question is should I host the WebJobs in the same AppService as the Api or would it be better to host each WebJob in their own AppService.
My question is should I host the WebJobs in the same AppService as the Api or would it be better to host each WebJob in their own AppService.
When you deploy WebJobs, you need to host it in the Azure App Service as a background task. WebJobs is a feature of Azure App Service that enables you to run a program or script in the same context as a web app, API app, or mobile app.
Also, Azure App Service payment is determined by the App Service plan that you run your apps on, while WebJobs is no need for additional cost.
For more details, you could refer to this article.
WebJobs are coupled with App services or Web app in the app service plan and they run as a background task of app service. We can't have an webjob independently running without the web app on the App service plan . We can control the scaling of web job in the case of multiple instance but web job has to be run as background task of app service.

Migrating MVC application to AZure Appservice and Cloud Service [duplicate]

This question already has answers here:
What is the difference between an Azure Web Site and an Azure Web Role
(10 answers)
Closed 5 years ago.
I am using MVC application in VS2015.Now we are planning to migrate our MVC5 Web application to Azure app service. I am getting confused with cloud service with Azure app service.
Just wanted to check can we migrate MVC5 application to Azure app service ?
I have installed Azure SDK
Do i need to install VS 2017 to have Azure App service or with Azure SDK will work.
Does the cloud service project and Azure App service both are different?
Please help me in understanding more
There are many differences between Azure Web Apps and Cloud Services.
App Service Web Apps is a fully managed compute platform that is optimized for hosting websites and web applications. This platform-as-a-service (PaaS) offering of Microsoft Azure lets you focus on your business logic while Azure takes care of the infrastructure to run and scale your apps.
On the other hand, Cloud Services is an example of Platform-as-a-Service (PaaS). Like App Service, this technology is designed to support applications that are scalable, reliable, and cheap to operate. Just like an App Service is hosted on VMs, so too are Cloud Services, however, you have more control over the VMs. You can install your own software on Cloud Service VMs and you can remote into them.
More control also means less ease of use. Unless you need the additional control options, it's typically quicker and easier to get a web application up and running in Web Apps in App Service compared to Cloud Services.
In Azure App Service, deployment and management are integrated into the platform, sites can scale quickly to handle high traffic loads, and the built-in load balancing and traffic manager provide high availability. You can move existing sites to Azure App Service easily with an online migration tool, use an open-source app from the Web Application Gallery, or create a new site using the framework and tools of your choice.
Also, there are many ways in which one can perform direct code deployment to Azure App Service. You can use FTP/Kudu (Git/Mercurial or OneDrive/Dropbox)/Web Deploy etc.
Hope this clears your confusion.

Is it possible to configure a virtual application to use a separate app pool in azure web apps?

We've recently migrated our site from Azure Cloud Services to use Web Apps.
Previously we had one main website application, which has a virtual application at /forums - in cloud services we configured this to use a separate app pool to the main website.
Whilst we've had no issues adding a virtual directory and deploying to it, we seem to be unable to configure a separate app pool, is there anyway to achieve this?
Here is a description on the Azure site, Migrate an enterprise web app to Azure App Service
Application Pools – In Web Apps, each site and its child applications run in the same application pool. If your site has multiple child applications utilizing multiple application pools, consolidate them to a single application pool with common settings or migrate each application to a separate web app.
So it seems that currently, we cannot achieve this.

WebRole vs WorkerRole

Hi I am implementing a TCPIP listener in Azure WorkerRole. The WorkerRole listens for incoming TCP data and stores it in Azure Table Storage.
Everything is working fine when i do this in Run() of WorkerRole.
But when implement the same thing in a Run() of WebRole, i get a message "WebIIS has exited" and debug mode exits in dev environment.
Why is this?
Can some one explain where the WebRole difers from WorkerRole? Can we implement a TCPIP listener which continuously listens in a WebRole?
Thanks
Anil
Just think that WebRole works like a Web Application. by receiving a request then it returns a reponse while Worker Role works like a Windows Service. Although both can hand TPC messages they difers in the way they hand it. Web Role only will be available while process the request. Worker Role will be available constantly. If you want a Web Role to be continuosly listening a TCP channel the most probably is that Worker Role will fit your requierements better.
Regards,
My answer on a similar question: https://stackoverflow.com/a/2610895/94559
In short, web roles are for IIS, and worker roles are for everything else. In this case, I think you want a worker role.
What is an Azure Cloud Service Role?
In Azure, a Cloud Service Role is a collection of managed, load-balanced, Platform-as-a-Service virtual machines that work together to perform common tasks. Cloud Service Roles are managed by Azure fabric controller and provide the ultimate combination of scalability, control, and customization
What is a Web Role?
Web Role is a Cloud Service role in Azure that is configured and customized to run web applications developed on programming languages / technologies that are supported by Internet Information Services (IIS), such as ASP.NET, PHP, Windows Communication Foundation and Fast CGI.
What is a Worker Role?
Worker Role is any role in Azure that runs applications and services level tasks, which generally do not require IIS. In Worker Roles, IIS is not installed by default. They are mainly used to perform supporting background processes along with Web Roles and do tasks such as automatically compressing uploaded images, run scripts when something changes in database, get new messages from queue and process and more.

Resources