Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Microsoft Azure: Enterprise Application Development

You're reading from   Microsoft Azure: Enterprise Application Development Straight talking advice on how to design and build enterprise applications for the cloud

Arrow left icon
Product type Paperback
Published in Dec 2010
Publisher Packt
ISBN-13 9781849680981
Length 248 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

Table of Contents (23) Chapters Close

Microsoft Azure: Enterprise Application Development
Credits
About the Authors
Acknowledgement
Acknowledgement
About the Reviewer
1. Preface
1. Introduction to Cloud Computing FREE CHAPTER 2. The Nickel Tour of Azure 3. Setting Up for Development 4. Designing our Sample Application 5. Introduction to SQL Azure 6. Azure Blob Storage 7. Azure Table Storage 8. Queue Storage 9. Web Role 10. Web Services and Azure 11. Worker Roles 12. Local Application for Updates 13. Azure AppFabric 14. Azure Monitoring and Diagnostics 15. Deploying to Windows Azure Index

Worker role internals


Building worker roles is fairly simple they are just class libraries that inherit from the Microsoft.ServiceHosting.ServiceRuntime.RoleEntryPoint class. Worker roles are automatically started when their host instance is started. During startup, code in the OnStart() method is executed. The OnStart() method returns a Boolean value. If OnStart() returns true, the role is started and the Run() method is called, whereas if OnStart() returns false, the role is stopped.

Our worker tasks should be coded in the Run() method, and we should not return from the Run() method. If we do, Azure will restart the worker role. Instead, and despite our best instincts, the code in the Run() method should be enclosed inside an infinite loop. The way to stop a worker role is to stop the host instance. For this reason, worker roles that need to function independently should all be separated into individual instances.

When our worker role instance is being shut down by Azure, the OnStop...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime