Push Notification in .Net core 2.1 MVC hosted in WebApp - azure

I am creating my website application in .net core 2.1. I have to deploy it in WebApp of Azure.
I am bit new to WebApp so not sure if I need to enable any service or any port on WebApp so Notfication works.
Otherwise normal way to show Notification is SignalR implemented.
1) Will SignalR will work for website hosted in WebApp?
If any Azure service that will do same please suggest

SignalR uses web sockets to connect with clients, so you will need to go into app settings and enable them for SignalR to work.
Here is a tutorial to help you set up your WebApp with SignalR:
https://learn.microsoft.com/en-us/aspnet/core/signalr/publish-to-azure-web-app?view=aspnetcore-2.2
Based on your scenario, Azure SignalR Service or Azure Notification Hub may be an option for you.

There is notification service in Azure Web Apps around sending push notification to Mobile Devices that are integrated with Azure.
In your case i assume you are talking about sending real time notifications within the web app ? Yes SignalR works great for that scenario , and you can look into dedicated SignalR service from Azure for this.
https://azure.microsoft.com/en-au/services/signalr-service/

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 SignalR Service

There is very limited information on azure signalR service. I need to clarify a question so any help would be highly appreciated.
how azure signalR service actually scale out ? I mean, as far I have worked on it. it seems that you have to include a primary key of azure signalR service to your hub. you can host you hub anywhere. So how hub scales out.?
SignalR Service manages all the client connections, as well as certain state information such as group membership. Your ASP.NET Core application establishes a connection to the SignalR Service instance.
When the application wants to send a message to connected clients, it uses this connection to instruct the service to do so. The service can also invoke hub methods via this connection.
You can read more about the service protocol.
When a client initiates a connection, it calls a negotiate endpoint on your ASP.NET Core application, which redirects the client to connect to the SignalR Service instance instead.
Because the ASP.NET Core application only needs to execute hub logic and most of the heavy lifting is done by SignalR Service, your application does not typically have to scale out to handle more SignalR connections. You can scale it based on the needs of the web traffic (serving web API and MVC requests, for example), and you can scale the service based on the needs of your SignalR traffic.
This is the documentation that I found and followed to have a signalr hub that worked across multiple App Service instances but behaving as a single hub.
You need to create a "backplane" in Azure using Storage queues and topics.
Details here: https://learn.microsoft.com/en-us/aspnet/signalr/overview/performance/scaleout-with-windows-azure-service-bus
#anthonychu is this still needed / applicable??

SignalR chat on azure

I have created a small and simple chat with signalr on a azure website. That doesn't work as expected.
After some hours on Google I found out, that signalr should be implemented different on Azure.
What is best practise?
Any good examples?
It should work on both mobile and in normal browsers.
Per the docs at: http://www.asp.net/signalr/overview/deployment/using-signalr-with-azure-web-sites
Deploying a SignalR Web App to Azure App Service
SignalR doesn't add any particular complications to deploying an
application to Azure versus deploying to an on-premises server. An
application that uses SignalR can be hosted in Azure without any
changes in configuration or other settings (though for WebSockets
support, see Enabling WebSockets on Azure App Service below.)...
To get signalr working when deploying to azure, I had to use
appBuilder.SetDataProtectionProvider(new MachineKeyProtectionProvider());
inside my Startup.cs Configure() method.
link to MachineKeyProtectionProvider gist
This is actually a workaround to this problem but it seems to work.
Follow this link : ASP.NET 5 app in Azure doesn't work with SignalR

Push Notifications Azure Mobile Service (Self Hosted)

I am looking into creating a Azure Mobile Service project and I also want to send push notifications to iOS and Android apps (Xamarin).
I don't have an Azure account and I am wondering if there is an easy way to self host the Azure Mobile Service project and use all its functionality?! Or do I have to host it on the Azure servers?
Thanks for you help!
Azure Mobile Services uses Notification Hubs for push, which is an Azure service that requires a subscription.

Azure Service Bus Relay and node.js

We've been writing services to access our on-premises databases through Azure Service Bus Relay for awhile now. That means that we've had to deploy them as WCF services. Our web site development is moving to node.js and I would like to begin deploying our API services on node as well. However, while the Azure NPM package has good support for queues/topics on Azure Service Bus, I can find no mention of the relaying capabilities. I've had a look at the code for the Azure SDK on github, but again, relay seems to be conspicuously absent.
Is it possible to use Azure Service Bus Relay with a node.js backend?
Now Azure support Node.js. You can find the infomration from here. This link is the samples for Node.js.
Right now, Relay only supports a WCF service. You can try to use Clemens Vasters' post on Port Bridge to get your scenario working. In his post, he describes creating a WCF client / service that will forward requests to a specific port.

Resources