azure-worker-roles

AZURE: async Run() in workerrole

旧巷老猫 提交于 2019-12-10 11:25:36
问题 I have an async task. async Task UploadFiles() { } I would like to call 'await' on UploadFiles() in Run() method in azure workerrole. but 'await' works only in the methods declared async. So can I make Run() method async like below: public override void Run() { UploadFiles(); } to public async override void Run() { await UploadFiles(); } 回答1: Worker roles only have a synchronous entry point. This means that you will need to keep the thread that the Run method runs on active. You can just call

Azure network communication between instances of the same role

筅森魡賤 提交于 2019-12-10 10:31:07
问题 Can multiple role instances of the same role can talk to each other by obtaining VIP (Virtual IP) address for a specific endpoint listened by all those instances from RoleEnvironment ? If so, is returned VIP can be load balanced to the caller (of RoleEnvironment methods) instance itself. 回答1: Role instances can talk to each other via internal endpoints. Unlike input endpoints, they are only visible to other instances within a deployment (regardless of the role). Talking directly, via internal

Azure Worker role Inner Exception of 'One of the request inputs is out of range.'

你离开我真会死。 提交于 2019-12-09 19:54:29
问题 I'm calling the CloudTableClient.CreateTableIfNotExist Method in my worker role and I'm getting an exception with an Inner Exception of 'One of the request inputs is out of range.' I did a little research and found that this is caused by naming the table an illegal table name, however, I've tried name my table several different names and all have not succeeded. Some of the table names I've tried are: exceptions exceptioninfo listoferrors All of them have failed with the same error. EDIT Here

What is the reason for “while(true) { Thread.Sleep }”?

不羁岁月 提交于 2019-12-09 06:37:10
问题 I sometimes encounter code in the following form: while (true) { //do something Thread.Sleep(1000); } I was wondering if this is considered good or bad practice and if there are any alternatives. Usually I "find" such code in the main-function of services. I recently saw code in the "Run" function in a windows azure worker role which had the following form: ClassXYZ xyz = new ClassXYZ(); //ClassXYZ creates separate Threads which execute code while (true) { Thread.Sleep(1000); } I assume there

Deploy a Web Role and Worker Role in a single instance

血红的双手。 提交于 2019-12-08 04:30:04
问题 I'm developing a scalable app and I use the web role, queue, worker role design... But right now (in the alpha tests phase) i'm concerned a little about cost cutting because i'm suffering from the common "out of cash" problem... So due to the test nature of the phase i was wondering if there's a way to make a role behave as web role and worker role? So i could deploy both of my projects (the "WebFrontEnd" project and the "QueueProcessor" project) on a single instance... Edit1: i do know how

Restart Azure Worker Role from Web Role

馋奶兔 提交于 2019-12-08 01:51:10
问题 I have a Worker Role that executes code (fetching data and storing it to Azure SQL) every X hours. The timing is implemented using a Thread.Sleep in the while(true) loop in the Run method. In the Web Role I want to have the abillity to manualy start the code in Worker Role (manualy fecth and store data in my case). I found out that the whole Worker Role can be restarted using the Azure Management API but it seems like an overkill, especialy looking at all the work needed around certificates.

Alerts for exceptions in an Azure worker role

旧街凉风 提交于 2019-12-07 20:50:05
问题 Is there an easy way to send an alert or notification in the Azure Management portal if a worker role throws an exception or has an error? I am using Azure 2.5 I have tracing and diagnostics all set up and can view the logs in the server explorer of Visual studio, but is there anyway to set an alert if for example and error message appears in the logs. I know you can set up alerts for monitoring metrics in the Management portal is there an easy way to add metrics for errors and exceptions? Or

Azure Worker: Read a message from the Azure queue in a mutex way

泪湿孤枕 提交于 2019-12-07 13:59:41
问题 The run method of my worker role is: public override void Run() { Message msg=null; while (true) { msg = queue.GetMessage(); if(msg!=null && msg.DequeueCount==1){ //delete message ... //execute operations ... } else if(msg!=null && msg.DequeueCount>1){ //delete message ... } else{ int randomTime = ... Thread.Sleep(randomTime); } } } For performance tests I would that a message could be analysed only by a worker (I don't consider failure problems on workers). But seems by my tests, that two

Is it possible to set a machinekey for an Azure Worker Role

試著忘記壹切 提交于 2019-12-07 11:23:57
问题 I have hosted an Owin WebAPI Server in an Azure Worker Role. The Owin Authentication middleware seems to use the MachineKey to encrypt and generate Tokens. This works perfectly when I have only one instance of this role, but as soon as I want to use several instances, the tokens generated by each instance are differents. This is the same problem as a web farm, Azure automatically solves this for WebRoles using the same .net Machine Key for all instances in Web.config. But this does not work

What's the concept of *worker role* in Windows Azure cloud?

≯℡__Kan透↙ 提交于 2019-12-07 07:27:06
问题 As I understood, it's long running process in server. Can it cover long-running program instance like online game server? 回答1: You can think of a worker role as a Windows Service or a Unix Daemon. It is, as you say, a perpetually executing process (although it may be in a wait state for a large portion of the time, but that's for you to decide). Essentially it can run any code you'd like to write. It can react to outside stimuli e.g. by polling from the Azure Queue service, but can also open