5 Worker Role Your Code
public class WorkerRole : RoleEntryPoint { public override void Run() { while (true) { Thread.Sleep(1000); //Do something here } public override bool OnStart() { // Set the maximum number of concurrent connections ServicePointManager.DefaultConnectionLimit = 12; //Connection configuration CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetting) => { var connectionString = RoleEnvironment.GetConfigurationSettingValue(configName); configSetting(connectionString); }); return base.OnStart(); }
Creating a Simple Worker Role
//Create Queue CloudStorageAccount sa = CloudStorageAccount.FromConfigurationSetting("DataConnectionString"); private CloudQueueClient qc = sa.CreateCloudQueueClient(); private CloudQueue q = qc.GetQueueReference("incoming"); q.CreateIfNotExist(); //Add Message CloudQueueMessage m = new CloudQueueMessage(Message.Text); q.AddMessage(m); //Read Message CloudQueueMessage m = q.GetMessage();
TcpClient c = new TcpClient(); c.Connect(" ", 4321); Stream s = c.GetStream(); StreamWriter sw = new StreamWriter(s); sw.WriteLine(data); sw.Flush();
Communicating with Worker Roles
Azure
Pluggable Services and Worker Roles
Call to Action For Download Download SharePoint VM 356C C60-D539896C66CE&displaylang=en Download Azure Developer Center Windows Azure SDK and Windows Azure Tools for Microsoft Visual Studio (November 2010) c4-9dadaa5ed018&displaylang=en For Reference Channel 9 SharePoint Developer Training Kit Channel 9 Azure Developer Training Kit