public void Run( string workerRoleAssembly, string configurationPath, string serviceDefinitionPath, string roleName, bool useHostedStorage) { var roleDirectory = Path.GetDirectoryName(workerRoleAssembly); if (string.IsNullOrWhiteSpace(roleDirectory)) { throw new ArgumentException("The worker role assembly must be in a specified directory."); } Directory.SetCurrentDirectory(roleDirectory); lock (gate) { // as hoststub is called asynchronously, it it possible that shutdown has already been requested // by the time we reach this point. if (_cancellationTokenSource != null && _cancellationTokenSource.IsCancellationRequested) { return; } var getMethod = typeof(LightBlueThreadControl).GetMethod("get_CancellationTokenSource", BindingFlags.NonPublic | BindingFlags.Static); _cancellationTokenSource = (CancellationTokenSource)getMethod.Invoke(null, null); } var runner = new HostRunner(); runner.Run(workerRoleAssembly, configurationPath, serviceDefinitionPath, roleName, useHostedStorage); }
static void Main() => HostRunner.Run <AppHost>();