当前位置: 首页>>代码示例>>C#>>正文


C# JobHost.Call方法代码示例

本文整理汇总了C#中Microsoft.Azure.WebJobs.JobHost.Call方法的典型用法代码示例。如果您正苦于以下问题:C# JobHost.Call方法的具体用法?C# JobHost.Call怎么用?C# JobHost.Call使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Azure.WebJobs.JobHost的用法示例。


在下文中一共展示了JobHost.Call方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        /// <summary>
        /// Set up for logging and call our web job functions as appropriate.
        /// </summary>
        public static void Main()
        {
            var env = EnvironmentDefinition.Instance;
            var timestamp = DateTime.UtcNow.ToString("yyyy-MM-dd_HH:MM");

            var logName = $"{env.Name}_report_{timestamp}";

            var host = new JobHost();
            host.Call(
                typeof(DailyReport).GetMethod("SendDailyReport"),
                new
                {
                    logName = logName,
                    log = $"container/{logName}"
                });

            // We refresh the bot caches every two hours for now. The bots will automatically
            // refresh on their own every 8 hours if the webjob fails to run for some reason.
            // It's better if we do it here so that user's don't see the latency.

            if (DateTime.UtcNow.Hour % 2 == 0)
            {
                logName = $"{env.Name}_refresh_{timestamp}";
                host.Call(
                    typeof(RefreshCaches).GetMethod("RefreshBotCaches"),
                    new
                    {
                        logName = logName,
                        log = $"container/{logName}"
                    });
            }
        }
开发者ID:CrewNerd,项目名称:BoatTracker,代码行数:35,代码来源:Program.cs

示例2: Main

        public static void Main(string[] args)
        {
            JobHostConfiguration config = new JobHostConfiguration();

            config.Tracing.ConsoleLevel = TraceLevel.Verbose;

            // Set to a short polling interval to facilitate local
            // debugging. You wouldn't want to run prod this way.
            config.Queues.MaxPollingInterval = TimeSpan.FromSeconds(2);

            FilesConfiguration filesConfig = new FilesConfiguration();
            if (string.IsNullOrEmpty(filesConfig.RootPath))
            {
                // when running locally, set this to a valid directory
                filesConfig.RootPath = @"c:\temp\files";
            }
            EnsureSampleDirectoriesExist(filesConfig.RootPath);

            config.UseFiles(filesConfig);
            config.UseTimers();
            config.UseSample();
            config.UseCore();
            var sendGridConfiguration = new SendGridConfiguration()
            {
                ToAddress = "[email protected]",
                FromAddress = new MailAddress("[email protected]", "WebJobs Extensions Samples")
            };
            config.UseSendGrid(sendGridConfiguration);

            ConfigureTraceMonitor(config, sendGridConfiguration);

            WebHooksConfiguration webHooksConfig = new WebHooksConfiguration();
            webHooksConfig.UseReceiver<GitHubWebHookReceiver>();
            config.UseWebHooks(webHooksConfig);

            JobHost host = new JobHost(config);

            host.Call(typeof(MiscellaneousSamples).GetMethod("ExecutionContext"));
            host.Call(typeof(FileSamples).GetMethod("ReadWrite"));
            host.Call(typeof(SampleSamples).GetMethod("Sample_BindToStream"));
            host.Call(typeof(SampleSamples).GetMethod("Sample_BindToString"));
            host.Call(typeof(TableSamples).GetMethod("CustomBinding"));

            // When running in Azure Web Apps, a JobHost will gracefully shut itself
            // down, ensuring that all listeners are stopped, etc. For this sample,
            // we want to ensure that same behavior when the console app window is
            // closed. This ensures that Singleton locks that are taken are released
            // immediately, etc.
            ShutdownHandler.Register(() => { host.Stop(); });

            host.RunAndBlock();
        }
开发者ID:wondenge,项目名称:azure-webjobs-sdk-extensions,代码行数:52,代码来源:Program.cs

示例3: Main

 static void Main(string[] args)
 {
     var host = new JobHost();
     Console.WriteLine("EventHubReader has been started at " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:tt"));
     host.Call(typeof(Functions).GetMethod("ReadEventHub"));
     //host.RunAndBlock();
 }
开发者ID:iremmats,项目名称:apim-eventhubreader,代码行数:7,代码来源:Program.cs

示例4: Main

 // Please set the following connection strings in app.config for this WebJob to run:
 // AzureWebJobsDashboard and AzureWebJobsStorage
 static void Main()
 {
     var host = new JobHost();
     // The following code will invoke a function called ManualTrigger and
     // pass in data (value in this case) to the function
     host.Call(typeof(Functions).GetMethod("ManualTrigger"), new { value = 20 });
 }
开发者ID:aaronhoffman,项目名称:azure-101,代码行数:9,代码来源:Program.cs

示例5: Main

        // Please set the following connection strings in app.config for this WebJob to run:
        // AzureWebJobsDashboard and AzureWebJobsStorage
        private static void Main()
        {
            var demoMode = (ConfigurationManager.AppSettings["ticketdesk:DemoModeEnabled"] ?? "false").Equals("true", StringComparison.InvariantCultureIgnoreCase);
            var isEnabled = false;
            var interval = 2;
            using (var context = new TdPushNotificationContext())
            {
                isEnabled = !demoMode && context.TicketDeskPushNotificationSettings.IsEnabled;
                interval = context.TicketDeskPushNotificationSettings.DeliveryIntervalMinutes;
            }
            var storageConnectionString = AzureConnectionHelper.CloudConfigConnString ??
                                             AzureConnectionHelper.ConfigManagerConnString;
            var host = new JobHost(new JobHostConfiguration(storageConnectionString));
            if (isEnabled)
            {
                host.Call(typeof(Functions).GetMethod("StartNotificationScheduler"), new { interval});
                host.RunAndBlock();
            }
            else
            {
                Console.Out.WriteLine("Push notifications are disabled");
                host.RunAndBlock();//just run and block, to keep from recycling the service over and over
            }


        }
开发者ID:sadiqna,项目名称:TicketDesk,代码行数:28,代码来源:Program.cs

示例6: Main

 // Please set the following connection strings in app.config for this WebJob to run:
 // AzureWebJobsDashboard and AzureWebJobsStorage
 static void Main()
 {
     var host = new JobHost();
     // The following code ensures that the WebJob will be running continuously
     //host.RunAndBlock();
     host.Call(typeof(Program).GetMethod("CreateQueueMessage"), new { value = "Hello world!" });
 }
开发者ID:RodricDegroote,项目名称:Server-Side-Advanced,代码行数:9,代码来源:Program.cs

示例7: Main

        public int Main(string[] args)
        {
            var builder = new ConfigurationBuilder();
            //builder.Add(new JsonConfigurationSource("config.json"));
            builder.AddJsonFile("config.json");
            var config = builder.Build();
            var webjobsConnectionString = config["Data:AzureWebJobsStorage:ConnectionString"];
            var dbConnectionString = config["Data:DefaultConnection:ConnectionString"];
            if (string.IsNullOrWhiteSpace(webjobsConnectionString))
            {
                Console.WriteLine("The configuration value for Azure Web Jobs Connection String is missing.");
                return 10;
            }

            if (string.IsNullOrWhiteSpace(dbConnectionString))
            {
                Console.WriteLine("The configuration value for Database Connection String is missing.");
                return 10;
            }

            var jobHostConfig = new JobHostConfiguration(config["Data:AzureWebJobsStorage:ConnectionString"]);
            var host = new JobHost(jobHostConfig);
            var methodInfo = typeof(Functions).GetMethods().First();

            host.Call(methodInfo);
            return 0;
        }
开发者ID:philljeff,项目名称:PartsUnlimited-master,代码行数:27,代码来源:Program.cs

示例8: Main

        static void Main()
        {
            JobHostConfiguration config = new JobHostConfiguration();

            var host = new JobHost(config);
            
            host.Call(typeof(Functions).GetMethod("QueueBackup"));
        }
开发者ID:markjbrown,项目名称:AzureDmlBackup,代码行数:8,代码来源:Program.cs

示例9: Main

        public static void Main(string[] args)
        {
            JobHostConfiguration config = new JobHostConfiguration();

            config.Tracing.ConsoleLevel = TraceLevel.Verbose;

            // Set to a short polling interval to facilitate local
            // debugging. You wouldn't want to run prod this way.
            config.Queues.MaxPollingInterval = TimeSpan.FromSeconds(2);

            FilesConfiguration filesConfig = new FilesConfiguration();
            if (string.IsNullOrEmpty(filesConfig.RootPath))
            {
                // when running locally, set this to a valid directory
                filesConfig.RootPath = @"c:\temp\files";
            }
            EnsureSampleDirectoriesExist(filesConfig.RootPath);
            config.UseFiles(filesConfig);

            config.UseTimers();
            config.UseSample();
            config.UseCore();
            var sendGridConfiguration = new SendGridConfiguration()
            {
                ToAddress = "[email protected]",
                FromAddress = new MailAddress("[email protected]", "WebJobs Extensions Samples")
            };
            config.UseSendGrid(sendGridConfiguration);

            ConfigureTraceMonitor(config, sendGridConfiguration);

            WebHooksConfiguration webHooksConfig = new WebHooksConfiguration();
            webHooksConfig.UseReceiver<GitHubWebHookReceiver>();
            config.UseWebHooks(webHooksConfig);

            JobHost host = new JobHost(config);

            host.Call(typeof(MiscellaneousSamples).GetMethod("ExecutionContext"));
            host.Call(typeof(FileSamples).GetMethod("ReadWrite"));
            host.Call(typeof(SampleSamples).GetMethod("Sample_BindToStream"));
            host.Call(typeof(SampleSamples).GetMethod("Sample_BindToString"));
            host.Call(typeof(TableSamples).GetMethod("CustomBinding"));

            host.RunAndBlock();
        }
开发者ID:brendankowitz,项目名称:azure-webjobs-sdk-extensions,代码行数:45,代码来源:Program.cs

示例10: Main

        // Please set the following connection strings in app.config for this WebJob to run:
        // AzureWebJobsDashboard and AzureWebJobsStorage
        static void Main()
        {
            var host = new JobHost();
            // The following code ensures that the WebJob will be running continuously
            Console.WriteLine("starting...");
            host.Call(typeof(Program).GetMethod("RunOnce"));

            //host.RunAndBlock();
        }
开发者ID:lucidcoding,项目名称:Campervibe_Booking,代码行数:11,代码来源:Program.cs

示例11: Main

        // Please set the following connection strings in app.config for this WebJob to run:
        // AzureWebJobsDashboard and AzureWebJobsStorage
        public static void Main(string[] args)
        {
            LogHelper.ConfigureLogging();
            Log.Information("Build Number: {buildNumber}", typeof(Program).Assembly.GetName().Version);

            var kernel = ConfigureServices();
            _dbService = kernel.Get<IDbService>();
            var jobHost = new JobHost();
            jobHost.Call(typeof(Program).GetMethod("EmailNotificationDaily"));
        }
开发者ID:ucdavis,项目名称:Commencement,代码行数:12,代码来源:Program.cs

示例12: Main

        public static void Main(string[] args)
        {
            JobHostConfiguration config = new JobHostConfiguration();
            FilesConfiguration filesConfig = new FilesConfiguration();

            // See https://github.com/Azure/azure-webjobs-sdk/wiki/Running-Locally for details
            // on how to set up your local environment
            if (config.IsDevelopment)
            {
                config.UseDevelopmentSettings();
                filesConfig.RootPath = @"c:\temp\files";
            }

            config.UseFiles(filesConfig);
            config.UseTimers();
            config.UseSample();
            config.UseCore();
            var sendGridConfiguration = new SendGridConfiguration()
            {
                ToAddress = "[email protected]",
                FromAddress = new MailAddress("[email protected]", "WebJobs Extensions Samples")
            };
            config.UseSendGrid(sendGridConfiguration);

            ConfigureTraceMonitor(config, sendGridConfiguration);
            
            EnsureSampleDirectoriesExist(filesConfig.RootPath);

            WebHooksConfiguration webHooksConfig = new WebHooksConfiguration();
            webHooksConfig.UseReceiver<GitHubWebHookReceiver>();
            config.UseWebHooks(webHooksConfig);

            JobHost host = new JobHost(config);

            host.Call(typeof(MiscellaneousSamples).GetMethod("ExecutionContext"));
            host.Call(typeof(FileSamples).GetMethod("ReadWrite"));
            host.Call(typeof(SampleSamples).GetMethod("Sample_BindToStream"));
            host.Call(typeof(SampleSamples).GetMethod("Sample_BindToString"));
            host.Call(typeof(TableSamples).GetMethod("CustomBinding"));

            host.RunAndBlock();
        }
开发者ID:paulbatum,项目名称:azure-webjobs-sdk-extensions,代码行数:42,代码来源:Program.cs

示例13: Main

        static void Main(string[] args)
        {
            LogHelper.ConfigureLogging();

            Console.WriteLine("Build Number: {0}", typeof(Program).Assembly.GetName().Version);

            var kernel = ConfigureServices();
            _dbService = kernel.Get<IDbService>();
            var jobHost = new JobHost();
            jobHost.Call(typeof(Program).GetMethod("EmailNotifications"));
        }
开发者ID:ucdavis,项目名称:Purchasing,代码行数:11,代码来源:Program.cs

示例14: Main

 // Please set the following connection strings in app.config for this WebJob to run:
 // AzureWebJobsDashboard and AzureWebJobsStorage
 static void Main()
 {
     var host = new JobHost();
     host.Call(typeof(Program).GetMethod("ProcessMethod"));
     // The following code ensures that the WebJob will be running continuously
     host.RunAndBlock();
     //TextWriter log = null;
     //StorageCredentials credential = new StorageCredentials(ConfigurationManager.AppSettings["AccountName"], ConfigurationManager.AppSettings["AccountKey"]);
     //CloudStorageAccount account = new CloudStorageAccount(credential, true);
     //UploadToBlog(account, log);
 }
开发者ID:Data-Online,项目名称:CimscoManage,代码行数:13,代码来源:Program.cs

示例15: Main

        // Please set the following connection strings in app.config for this WebJob to run:
        // AzureWebJobsDashboard and AzureWebJobsStorage
        static void Main()
        {

            var host = new JobHost();
            var method = typeof(Program).GetMethod("SendWelcome");
            host.Call(method, new { dummy = "dummy" });


            //var host = new JobHost();
            //// The following code ensures that the WebJob will be running continuously
            //host.RunAndBlock();
        }
开发者ID:danieros,项目名称:SendMail,代码行数:14,代码来源:Program.cs


注:本文中的Microsoft.Azure.WebJobs.JobHost.Call方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。