I am completely new to using Azure so I could use a little advice. Here is my scenario. I need to develop an application that was originally thought to be a windows service but is now to be deployed to Azure. The app is a scheduling application that reads from a DB and calls a couple of different APIs when it's time to either start or stop an event. The DB will be stored in Azure as well.
Initially, this sounds like a WebJob, but the issue is I also need for the app to be both host and client for a SignalR WebSocket. The intent of this is to have two instances communicate with each other and a backup self-promote if it loses communication with the primary. My understanding is that WebJobs don't support things like WebSockets.
Is there an Azure service that would work well for this. I can use a virtual machine but would like to avoid it if possible. Any help is appreciated. Thanks.
I think you're looking for this one:
https://azure.microsoft.com/en-us/services/signalr-service/
Docs:
https://learn.microsoft.com/en-us/azure/azure-signalr/signalr-overview
Sample code:
https://github.com/aspnet/AzureSignalR-samples
Related
I have an azure static web app that gets data via azure functions written in javascript.
I would like to subscribe to external data push services using wss websockets. The socket may be open for up to 24 hours. I thought, having read some answers on SO that I might be able to do this using durable functions but it appears that it isn't possible.
Almost all examples of using websockets in azure I've seen create a server, eg with SignalR, and communicate with the browser.
This helps. It shows how to build a server-side websockets client in a webjob
https://mikewaniewski.wordpress.com/2015/06/14/websocket-client-as-azure-webjob/
but as it is from 2015 I wondered if there more recent technologies available to do the same thing? Before I go about setting all that up.
Thanks in advance
I need to subscribe to a third-party web socket feed and process the messages received (e.g. write them to a queue).
I'm testing the service locally with a C# Windows Console application and it works just fine: I subscribe to the feed, I add even handlers, and then I do Console.ReadLine() in order to keep the application running and listening to the feed.
Now I need to deploy it to Azure. So my question is - what Azure service is appropriate for this scenario? That is, I need to deploy, subscribe to the feed and keep it running.
Azure Cloud Services is what you're looking for. This is (as of right now at least) their official always on service for your use case. It is a managed windows service, meaning that it will manage making sure that your service is running and bringing it up and down. You can set auto-scaling if you need it.
Read more here
One option is to deploy a Windows service to a virtual machine, but that could be an overkill.
The other alternative is continuous web jobs.
I'm currently developing a SOA based architecture in Azure, using disparate Web API services (they'd probably qualify as Microservices, but I'm hesitant to use the term).
I have a service which is triggered by the Azure Scheduler. It does some "stuff" and then needs to call another Web API (via HttpClient) service to trigger something else. To do this, I need to know the URI of the 2nd service. When running locally, this is fine, as it is something like
POST http://localhost:1234/2ndService/api/action
However, when I deploy to Azure (using Internal Only as the access level), it gets an obfuscated URI, such as http://microsoft-apiapp8cf3d453-39d8-4b3b-ad00-e9d8008a9b58, which I obviously can't guess at deploy time.
Any ideas on how to solve this problem? Or have I made a fundamental error here?
Instead of relying on public http endpoints, have you considered passing messages via queues in Azure Table Services? It's very simple to do and is going to be more robust since you can take advantage of built-in features like guaranteed message delivery.
The overall idea is that Service A does some "stuff" then puts a message on queue ONE. Service B continuously reads from queue ONE until it picks up a new message from Service A (or any other service for that matter) and then does its "STUFF". You can continue to chain calls like this to other services that need to be notified.
If you want a more elegant solution you can look at using Service Bus Topics but the concept is basically the same.
Also, since you mentioned that your architecture is much like microservices, you can check out the new Service Fabric which is designed for your scenario.
In case of Azure Web Apps, you may always see such properties going to the web app dashboard, then properties. When deploying from the Visual Studio, you can set the URL as you want - just checked it, and it works fine.
Not very clear what technology do you use - is it IaaS VM? Is it Web Apps?
From my standpoint, each service should be deployed as a separate Web App (or API App, if you want). Each Web App has defined its own name as in yourwebapp.azurewebsites.net, so once you have provisioned the Web App no 1 in Azure, you know its address so you will call it from the Web App no 2.
In all the cases, you should have fully qualified domain names, and not local/internal ones.
I have developed a windows service. i need to deploy it in Azure App Service. Please someone explain me how to do that. Is there any way to install it on console or any other option.
You can't deploy a Windows Service using App Service. One option is to convert your code into a Web Job. Another option is to use a Virtual Machine instead of App Service.
Azure App Service is the service that should be used for Web/Mobile and basically is the web-server-as-a-service. You have almost no access to the underlying system, and system-wide actions like a working windows service is likely impossible.
I see three ways:
1) Migrate to Worker Role, but it is classic model. There is a good article on how to do that, i took a look and did not see any potential problems. It is more simple way.
2) Migrate your windows service to Web Job and run it as a background service. It will need you to rewrite some parts of your service, i think - but there are supported executable formats out-of-the-box. Take a look at how it works.
3) Take a look at Azure Functions - it is "trigger-and-invoke" service that can be used for listening for events and executing actions.
But, if you need to catch some events from DB, then i am not sure that it will be possible with that, because Web Job is more like a service that listens for external events, and yours scenario looks like you want to catch events from the same server. That way, i would recommend you to place it on a virtual machine to avoid the rewriting or migrating time-consuming issues.
We are going to host our ASP.Net web site on Azure server. I am not quite familiar with Azure. I need to create some kind of scheduler which will send request to google API once a week and save response data to DB. I read some articles about Worker Role. Is it suitable for this? How it should be deployed to the Azure server? Any other solutions?
You could certainly make use of Worker Role for that purpose however I would not recommend going down that route as you are only going to use the functionality once a week. Or in other words you would be under utilizing the resources. Do take a look at Windows Azure Mobile Service Scheduler: http://www.windowsazure.com/en-us/develop/mobile/tutorials/schedule-backend-tasks/. Other alternative would be use a 3rd party service like Aditi Scheduler: http://www.aditicloud.com/. There's also a website which also allows you to do the same functionality (I'm sorry I forgot the name of that site :)).
If you're still keen on doing it through Windows Azure Worker Role, I wrote a blog post about the same which you may find useful: http://gauravmantri.com/2013/01/23/building-a-simple-task-scheduler-in-windows-azure/.