Skip to content

Instantly share code, notes, and snippets.

@nickheppleston
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickheppleston/ab48643202f12a16fa35 to your computer and use it in GitHub Desktop.
Save nickheppleston/ab48643202f12a16fa35 to your computer and use it in GitHub Desktop.
Message Worker - Worker Role - OnStart() Method
public class MessageWorker : RoleEntryPoint
{
/* This GIST only demonstrates the OnStart() method. */
public override bool OnStart()
{
Trace.WriteLine("Starting MessageWorker Worker Role Instance...");
// Initialize Worker Role Configuration
InitializeConfigurationSettings();
// Re-configure Logging (update logging to runtime configuration settings)
LogTargetManager.SetLogTargetBaseDirectory("MessageWorker", RoleEnvironment.GetLocalResource("CustomLogs").RootPath);
LogLevelManager.SetMinimimLogLevel(_workerRoleConfiguration.MinimumLogLevel);
// Formally start the Worker Role Instance
logger.Info("Starting Worker Role Instance (v{0})...", Assembly.GetExecutingAssembly().GetName().Version.ToString());
// Log Configuration Settings
LogConfigurationSettings();
// Set the maximum number of concurrent connections
ServicePointManager.DefaultConnectionLimit = 12;
return (base.OnStart());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment