Async / Await in Cloud Services Worker Roles?

Good evening,
I was wondering if and how one would be able to utilize async / await for Azure Cloud Services' Worker Roles? Basically I have background jobs that will/shall run on worker roles, however many of those are performing up/downloads from Azure Storage blobs
and ideally I'd like to await those calls.
So is async/await natively supported for CS Worker Roles (using Azure SDK 2.5) and if so, how? And if not.. is it planned at all?
Thanks,
-Jörg

Hi,
I would suggest you have a look at this thread:
http://stackoverflow.com/questions/15991287/async-await-in-azure-worker-role-causing-the-role-to-recycle
A simple solution is to just do this:
public override void Run()
RunAsync().Wait();
public async Task RunAsync()
while (true)
await Task.Delay(60000);
Hope this helps.
Best Regards,
Jambor
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • Is this the best design for asynchronous notifications (such as email)? Current design uses Web Site, Azure Service Bus Queue, Table Storage and Cloud Service Worker Role.

    I am asking for feedback on this design. Here is an example user story:
    As a group admin on the website I want to be notified when a user in my group uploads a file to the group.
    Easiest solution would be that in the code handling the upload, we just directly create an email message in there and send it. However, this seems like it isn't really the appropriate level of separation of concerns, so instead we are thinking to have a separate
    worker process which does nothing but send notifications. So, the website in the upload code handles receiving the file, extracting some metadata from it (like filename) and writing this to the database. As soon as it is done handling the file upload it then
    does two things: Writes the details of the notification to be sent (such as subject, filename, etc...) to a dedicated "notification" table and also creates a message in a queue which the notification sending worker process monitors. The entire sequence
    is shown in the diagram below.
    My questions are: Do you see any drawbacks in this design? Is there a better design? The team wants to use Azure Worker Roles, Queues and Table storage. Is it the right call to use these components or is this design unnecessarily complex? Quality attribute
    requirements are that it is easy to code, easy to maintain, easy to debug at runtime, auditable (history is available of when notifications were sent, etc...), monitor-able. Any other quality attributes you think we should be designing for?
    More info:
    We are creating a cloud application (in Azure) in which there are at least 2 components. The first is the "source" component (for example a UI / website) in which some action happens or some condition is met that triggers a second component or "worker"
    to perform some job. These jobs have details or metadata associated with them which we plan to store in Azure Table Storage. Here is the pattern we are considering:
    Steps:
    Condition for job met.
    Source writes job details to table.
    Source puts job in queue.
    Asynchronously:
    Worker accepts job from queue.
    Worker Records DateTimeStarted in table.
    Queue marks job marked as "in progress".
    Worker performs job.
    Worker updates table with details (including DateTimeCompleted).
    Worker reports completion to queue.
    Job deleted from queue.
    Please comment and let me know if I have this right, or if there is some better pattern. For example sake, consider the work to be "sending a notification" such as an email whose template fields are filled from the "details" mentioned in
    the pattern.

    Hi,
    Thanks for your posting.
    This development mode can exclude some errors, such as the file upload complete at the same time... from my experience, this is a good choice to achieve the goal.
    Best Regards,
    Jambor  
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Multiple Async Task Method in single worker role

    Hi all,
    I want to combine two more Async task method in single Worker role project .i.e.
          public override void Run()
                    this.RunAsyncForInvoice(this.cancellationTokenSource.Token).Wait();
                    this.RunAsyncForStatisticalJournal(this.cancellationTokenSource.Token).Wait();           
    but i tried something above like this but it starts only first async method, i want to start both methods, please give me a suggestion to do this requirement.
    jeganna

    Hi jeganna,
    Thanks for your posting!
    In additional, as Bhushan said, you also refer to this code sample from this page(https://azureproviders.codeplex.com/wikipage?title=MultiThreadedWorkerRole%20project
    Another way, I think you could add your Async method into the Task,
    public override void Run()
    var tasks = new List<Task>();
    tasks.Add(RunTask1Async());
    tasks.Add(RunTask2Async());
    Task.WaitAll(tasks.ToArray());
    Hope that helps.
    Regards,
    Will
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Cloud service web role did not get request

    Hi Team,
    we have an application host in web role in a cloud service, 
    sometimes it keeps loading when clicking a button in GUI and got no response till our GUI timeout (30 minutes)
    we use Fiddler to trace the http request and also check IIS logs and found that sometimes the web role didn't get a request,  sometimes the IIS
    got the request and finished to processe the request but didn't return result to GUI.
    it seems the message lost during interaction between UI and web role.
    note that this problems comes out just recently.
    is there some known issues related with this kind of problems. 
    thanks in advance.

    hi Baker,
    Firstly, I need confirm what's meaning is GUI from your description ? The GUI is your cloud service project UI? Or your UI in your client?
    Secondly, base on my experience, we usually could occur timeout error because of the azure load balancer and the long time request.
    For this error, I recommend you refer to those thread:
    Azure Web Role - Long Running Request (Load Balancer Timeout?)
    Windows Azure Load Balancer TimeOut for Cloud Service Roles (PAAS Web/Worker)
    Windows Azure Load Balancer Timeout Details
    http://social.msdn.microsoft.com/Forums/windowsazure/en-US/89b283f0-dfca-49a7-99fe-c3b73d77ff6d/azure-load-balancer-sending-http-request-to-multiple-web-role-instances?forum=windowsazuredevelopment
    If I misunderstood, please let me know.
    Regards,
    Will
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Change basicHttpBinding to wsHttpBinding in azure cloud service web role

    So I created a cloud service project in visual studio and added wcf service web role to cloud service.
    By default wcf service web role binding is set to basicHttpBinding.
    Currently my web.config looks like this:
    <?xml version="1.0"?>
    <configuration>
    <system.diagnostics>
    <trace>
    <listeners>
    <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    name="AzureDiagnostics">
    <filter type="" />
    </add>
    </listeners>
    </trace>
    </system.diagnostics>
    <system.web>
    <compilation debug="true" targetFramework="4.0" />
    </system.web>
    <system.serviceModel>
    <behaviors>
    <serviceBehaviors>
    <behavior>
    <!-- To avoid disclosing metadata information, set the value below to false before deployment -->
    <serviceMetadata httpGetEnabled="true"/>
    <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
    <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
    </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    </system.serviceModel>
    <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <directoryBrowse enabled="true"/>
    </system.webServer>
    </configuration>
    How do I change my config to use wsHttpBinding?

    Hi,
    Please refer to
    http://msdn.microsoft.com/en-us/library/ms733099.aspx. From my experience, in Windows Azure, we cannot use Windows authentication (the default configuration for WSHttpBinding), unless we use WAAD and let the cloud server join the local domian. So it is
    needed to turn off authentication, or use an alternative authentication mechanism (such as username and password).
    Best Regards,
    Ming Xu
    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support
    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

  • Warning: This request requires buffering data to succeed (while Publishing using VS 2012 to Cloud Service - Web Role

    While publishing using VS 2012 professional to Azure Web Role getting following warning. After this warning even if i waited for hours, publish process never finish and then I have to manually deploy the package on Azure Cloud Instance.
    Warning: This request requires buffering data to succeed.

    Thank you for reply @Will,
    I do not have access to my work station computer at this moment. will share the screenshot. Basically what happens is -
    1. I start the publish wizard on Windows Azure Project (which as one web role configured)
    2. Proceed the publish wizard with advanced options enabled for remote debugging and remote connection enabled.
    3. The publish wizard finish and it starts uploading the package and configuration on the azure could service.
    4. In the Microsoft Windows Azure activity log pane of the Visual Studio 2012 Professional, after 10-15 minutes it starts showing following warning continously, i even waited for few hours but publish process never completes. Finally i have cancel the publish
    process and upload packages and config manually on the azure portal. 
    Warning: This request requires buffering data to succeed.

  • Azure Web Apps (Web Sites) vs Azure Cloud Services (Web Roles)

    Hi All,
    Need some help in choosing between the Web App or a Web Role for a MVC5 application that we are going to build. We are planning to build an MVC5 application which will consume a Web API (hosted on Azure). The MVC5 application would be an external site and
    it needs to be load balanced and it would be hosted on Azure.
    We are not able to decide on the hosting options for the same ... between Azure Web Apps and a Web Role. We didnt come across anything which will help us to make a choice as to where the Web Apps fall short or which one should one go for etc.
    Any help on this front would be highly appreciated.
    Regards,
    Saurabh

    To make your life easier you should start by using Web Apps, they have many more features than Web Roles (git deployment, backup, free sku, webjobs, continuous integration and many more).
    There are some scenarios that are not supported like remote desktop to the VM.
    But the reason you should start with them is that unlike Web Roles you won't have any special code relying on the environment you are running on so you will be able to easily move to web roles in case you find a scenario that is not supported by Web Apps.

  • 'role discovery data is unavailable' cloud service (staging)

    This has been posted on stackoverflow, so apologies for the cross post, but I'm trying to gain traction on fixing this and losing time.
    I currently have a production cloud service working. I moved a project dependency from being a direct dll reference to local nuget package and after some re-factoring, decided to deploy my efforts to the staging site.
    Locally, the changes with the dependency appears to be working correctly; the site loads and works well using the azure compute emulator.
    However, when I deploy to the staging environment (via visual studio publish to azure option) the deployment fails as it detects multiple cycles of the instance which points to a spin up issue. When I've jumped on the box to try and find the route cause, I
    can see the dreaded role discovery data is unavailable exception.
    My gut hunch is nuget has updated a package which caused this but can't see what and why it would work locally but not in the cloud. I thought it might be the azure caching but it looks as though I'm using the same version as the live (working) site.
    - Does anyone have a fix for this?
    - If this works locally (cuts out many answers I've seen when you see this using the emulator), what am I missing or including to prevent this working in the cloud?
    - Is there a way I can debug this further to find out why I'm getting the exception
    Many, many thanks in advance to anyone who spares any time reading this

    Hi Sir,
    Base on my experience, if we  implement the references using NuGet, we could see those DLL files from  "References". I recommend you could set those DLL files "Copy Local" to "true". And try to deploy project
    again. And I wondered know what error details when you deployed project.  The link below is about how to remote debug cloud service, please try it.
    http://msdn.microsoft.com/en-us/library/azure/ff683670.aspx
    Sample:
    http://code.msdn.microsoft.com/windowsazure/Remote-Debugging-Windows-dedaaec9
    For this error information, you could see the similar thread:http://stackoverflow.com/questions/11547855/azure-role-discovery-data-is-unavailable-error-when-switching-from-iisexpress
    Regards,
    Will
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Direct Traffic to one node in Cloud Service

    Is there a way to make a cloud service (web role) always use one of the nodes, there are two in this scenario, and only direct to the other one if the first one gets shut down. We have a piece of legacy software we use in our Cloud Service and we are waiting
    on it being updated so it can work across the load balancer, but currently it does not. So we only have one node in the service. I would like to have two and see if we can always hit node 1 for example, and then hit node 2 if 1 is down. I am assuming, maybe
    wrongly, that this would still be within SLA, and if maintenance was happening then both nodes would not get shutdown. Is it possible to maybe have a web role class which controls the load balancer traffic?
    Thanks
    Eamonn

    Hi Eamonn,
    Thanks for your posting!
    >>Is there a way to make a cloud service (web role) always use one of the nodes, there are two in this scenario,...
    Base on my experience, if we have one or more instances of a VM (Web or Worker role), the traffic will be distributed amongst the instances. We isn't allowed to specify which instances. Please see David's psot(http://stackoverflow.com/a/12726613
    >> I would like to have two and see if we can always hit node 1 for example, and then hit node 2 if 1 is down. I am assuming, maybe.....
    About this requirement, I suggest you could try to those steps:
    1.create a web role with adding a web service or create a web role using WCF service.
    2.create a service with the instance information, like this:
    [WebMethod]
    public ReturnResult ReverseString(string value)
    ReturnResult rr = new ReturnResult();
    rr.ReturnString = new string(value);
    rr.HostName = RoleEnvironment.CurrentRoleInstance.Id;;
    return rr;
    //Class
    public class ReturnResult
    private String returnString;
    public String ReturnString
    get { return returnString; }
    set { returnString = value; }
    private String hostName;
    public String HostName
    get { return hostName; }
    set { hostName = value; }
    3.Host this service on azure cloud service
    4.Create a new project whatever it is webpage or console application.
    5.using the Thread Pool or BackgroundWorker to send the concurrent request.
    6.Check the results list and host name.
    After made it, you could get the every requests hot which instances .
    If you'd like to custom the Azure loadbalancer, I recommend you could refer to those documents:
    http://msdn.microsoft.com/en-us/library/azure/jj151530.aspx
    http://blogs.msdn.com/b/kdot/archive/2013/06/29/implementing-custom-load-balancing-with-sticky-connections-on-windows-azure.aspx
    Regards,
    Will
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Down Time When we swap Cloud service Staging and Production

    Hi Team,
    Any one help me to know.
    What will be the downtime while we doing the VIP Swap of Staging Production environment (Cloud service - web role / worker role)?
    Cloud service in Production down time.
    Thanks in Advance.

    Because of update domains, if you have more instances for your roles, each role's instance that is part of one update domain will be updated during that update domain's update, so there is absolutely no downtime.

  • How do I configure Azure to let my cloud service make an outbound API call

    My cloud service works locally when I debug it, but when I deploy it, I know it has database access because database updates are taking place.
    It seems like the service is not able to call make calls to the Yammer API on port 443 for SSL (is that right?)
    https://www.yammer.com/api/v1/messages.xml?older_than=[MinMessageID]
    That is one example, but all the calls start with everything up to
    https://www.yammer.com/api/v1
    Is there a firewall setting I need to create so that my cloud service can make outbound calls?
    Thank you for any help.

    Hi,
    I am glad to hear that you have solved your issue. If you have any difficulty in future programming, we welcome you to post in forums again.
    Thanks for your posting.
    Best Regards,
    Jambor
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • SSL and custom domain configuration for cloud service

    Hi,
    I am doing custom domain mapping and SSL configuration for a cloud service web role. Another important aspect is Cloud service web role uses ADFS in between for authentication.
    I have custom domain mapped, SSL uploaded on cloud services Certificates
    tab in management portal, certificate .pfx and chaining certs .CER are added as below -
    <Certificate name="UATCert" thumbprint="A" thumbprintAlgorithm="sha1" />
    <Certificate name="Certificate1" thumbprint="B" thumbprintAlgorithm="sha1" />
    <Certificate name="Certificate2" thumbprint="C" thumbprintAlgorithm="sha1" />
    I see these certificates getting added properly to Azure cloud service web role instance VM.
    The problem is, when I access the custom domain,
    https://mysite.com/default.aspx in the browser ultimately after ADFS login I see
    https://cloudservice.cloudapp.net/default.aspx. My understanding is, cloudapp.net should not be seen in the browser to the client. Also I keep getting error of certificates stating "There is
    a problem with this website’s security certificate" when browser shows cloudapp.net url.
    How can I avoid display of cloudapp.net in browser and show only custom domain Url. Also how can I avoid this certificate error ?
    Thoughts? 
    http://sanganakauthority.blogspot.com/

    Hi kunal,
    Based what you described, I understand that you want to use the custom domain for cloud service web role and apply azure active directory authentication to the web role application.
    >>>The problem is, when I access the custom domain,
    https://mysite.com/default.aspx in the browser ultimately after ADFS login I see
    https://cloudservice.cloudapp.net/default.aspx. 
    As for above issue, I think you should make sure you have registered the web application in azure AD both "SIGN-ON URL" and "Reply URL" are
     https://mysite.com/default.aspx 
    >>>Also I keep getting error of certificates stating "There is a problem with this website’s security certificate" when browser shows cloudapp.net url.
    Try to upload a valid certificate (provided by CA) to cloud service for your custom domain.
    Best Regards,
    Fuxiang
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a
    href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

  • What are Azure limitations for Websockets in Cloud Services (web and worker role)?

    A WebSocket Server should be built on Azure platform with OnPrem connections and have questions regarding limitations for Websockets in Azure Cloud Services - web and worker roles.
    Websockets can be configured for Web Sites and limitations are understood, but Azure Websites is not an option. 
    Nevertheless it is planned to run a web service (without UI - no web site) as a Cloud service which has secure websocket (WSS) connections to OnPrem machines. Websocket protocol is enabled for IIS8 on Cloud services web and worker roles. Azure Service Bus Relay
    is not an option.
    Questions:
    1) Are Websockets supported for Azure Cloud services web and worker roles? we assume yes
    2) What are potential limitations from Azure side to support concurrent Websocket connections? We are aware that CPU, memory etc are limitations, but are there additional limitations from MS Azure side? 
     

    Hi,
    As I know, azure cloud service web and worker role support Websockets, users can connect to the role via the special endpoint, if we use Azure cloud service, I think we can monitor the metrics such as CPU, memory, etc... and scale our cloud service via these
    metrics to keep the websockets working, refer to
    http://azure.microsoft.com/en-us/documentation/articles/cloud-services-how-to-scale/ for more information about how to scale a cloud service.
    Regards

  • Can a Worker Role process call Antimalware for Azure Cloud Services programmatically?

    I'm trying to find a solution that I can use to perform virus scanning on files that have been uploaded to Azure blob storage.  I wanted to know if it is possible to copy the file to local storage on a Worker Role instance, call Antimalware for Azure
    Cloud Services to perform the scan on that specific file, and then depending on whether the file is clean, process the file accordingly.  If the Worker Role cannot call the scan programmatically, is there a definitive way to check if a file has been scanned
    and whether it is clean or not once it has been copied to local storage (I don't know if the service does a real-time scan when new files are added, or only runs on a schedule)?  

    Hi,
    I would suggest you have a look at this article:
    http://azure.microsoft.com/blog/2014/10/30/microsoft-antimalware-for-azure-cloud-services-and-virtual-machines/, please note the Microsoft Antimalware Client and Service is not installed by default in cloud service, please try to use the PowerShell
    cmdlet, Set-AzureServiceAntimalwareExtension to enable antimalware in your cloud service. Here's some more info:http://msdn.microsoft.com/en-us/library/azure/dn771718.aspx
    Best Regards,
    Jambor
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to develop and deploy multiple worker roles in single azure cloud services?

    I am Manikandan, From Myeasydocs.com.
    We have developed our application as web projects.  Now we are going to move to azure cloud services, i have successfully migrated our application in cloud services and it worked fine. I am having difficulties with back ground task. i have nearly 12
    schedule tasks in our applications. I need assist on creating multiple worker role creation and deployment.
    Is there is any site on explaining the worker role process in details?
    Thanks in advance .. !!

    Hi,
    In Worker role, Applications hosted within worker roles can run asynchronous, long-running or perpetual tasks independent of user interaction or input. It is a service component that is useful for generalized development, and may perform background processing
    for a web role. A worker role is frequently used for long-running tasks that are non-interactive, but you can host any type of workload.
    I suggest you to follow the below article which explains about Creating and Deploying of Web Roles and Worker Roles in Azure Cloud Service using Visual Studio.
    https://msdn.microsoft.com/en-us/magazine/jj618299.aspx
    Hope this helps !
    Regards,
    Sowmya

Maybe you are looking for

  • Error in User integration with SRM

    Hi Everyone, We are using SRM5.0 and Classic Scenario. We have a issue with user integration. One user for whom i am trying to integrate into SRM system but it is not integrating properly. In USERS_GEN, I am getting error as ' Assignment : Business p

  • Crs Not Starting _ private Interconnect Down

    Hello All, I Have Installed 2 node 10g R2(10.2.0.1) RAC on Solaris 10 T2000 Machines. Yesterday my Second Node Crs gone down. I tried to start it but it didn't start. Then i checked that Private IP (interconnect) is not Pinging from both the node. Bu

  • Can I see Pages presentation on my TV using Apple TV?

    Can I see Pages presentation on my TV using Apple TV?

  • AP and AR

    Are there any good resources for properly configuring security for the AP, AR modules, including users, permissions etc?

  • Fix for iTunes not installing on windows 8

    Well I had this issue and search all over never saw a specific answer. Here is how I fixed it. Even if you are an administrator you need to be able to right click the itunes installer and run as administrator, I kept having the Apple Application Supp