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


C# JobHost.RunAndBlock方法代码示例

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


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

示例1: Main

        static void Main()
        {
            CreateDemoData();

            JobHost host = new JobHost();
            host.RunAndBlock();
        }
开发者ID:andreychizhov,项目名称:microsoft-aspnet-samples,代码行数:7,代码来源:Program.cs

示例2: Run

        public static void Run(string connectionString)
        {
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);

            CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();
            CreateTestQueues(queueClient);

            try
            {
                CloudQueue firstQueue = queueClient.GetQueueReference(_nameResolver.ResolveInString(FunctionChainingPerfTest.FirstQueueName));
                firstQueue.AddMessage(new CloudQueueMessage("Test"));

                _startBlock = MeasurementBlock.BeginNew(0, HostStartMetric);

                JobHostConfiguration hostConfig = new JobHostConfiguration(connectionString);
                hostConfig.NameResolver = _nameResolver;
                hostConfig.TypeLocator = new FakeTypeLocator(typeof(FunctionChainingPerfTest));

                JobHost host = new JobHost(hostConfig);
                _tokenSource = new CancellationTokenSource();
                Task stopTask = null;
                _tokenSource.Token.Register(() => stopTask = host.StopAsync());
                host.RunAndBlock();
                stopTask.GetAwaiter().GetResult();
            }
            finally
            {
                DeleteTestQueues(queueClient);
            }
        }
开发者ID:rafaelmtz,项目名称:azure-webjobs-sdk,代码行数:30,代码来源:FunctionChainingPerfTest.cs

示例3: QueueMessageLeaseRenew

        /// <summary>
        /// There is a function that takes > 10 minutes and listens to a queue.
        /// </summary>
        /// <remarks>Ignored because it takes a long time. Can be enabled on demand</remarks>
        // Uncomment the Fact attribute to run
        //[Fact(Timeout = 20 * 60 * 1000)]
        public void QueueMessageLeaseRenew()
        {
            _messageFoundAgain = false;

            _queue.AddMessage(new CloudQueueMessage("Test"));

            _tokenSource = new CancellationTokenSource();
            JobHost host = new JobHost(_config);

            _tokenSource.Token.Register(host.Stop);
            host.RunAndBlock();

            Assert.False(_messageFoundAgain);
        }
开发者ID:ConnorMcMahon,项目名称:azure-webjobs-sdk,代码行数:20,代码来源:LeaseExpirationTests.cs

示例4: Main

        static void Main(string[] args)
        {
            CloudStorageAccount storageAccount;
            if (CloudStorageAccount.TryParse(
                ConfigurationManager.ConnectionStrings[STORAGE_CONN_STR_KEY_NAME].ConnectionString,
                out storageAccount))
            {
                // Create the queue we're using to trigger on if it doesn't already exist.
                CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();
                CloudQueue queue = queueClient.GetQueueReference(PICTURE_LOADER_QUEUE_NAME.ToLower());
                queue.CreateIfNotExists();
            }
            else
            {
                Console.WriteLine("Unable to initialize CloudStorageAccount.");
            }

            JobHost jobHost = new JobHost();
            jobHost.RunAndBlock();
        }
开发者ID:rickrain,项目名称:ContosoDemoWeb,代码行数:20,代码来源:Program.cs

示例5: Main

 static void Main(string[] args)
 {
     JobHost host = new JobHost();
     host.RunAndBlock();
 }
开发者ID:sjkp,项目名称:MessageAPE,代码行数:5,代码来源:Program.cs

示例6: Main

 private static void Main(string[] args)
 {
     var host = new JobHost();
     host.RunAndBlock();
 }
开发者ID:shithead548,项目名称:todo-azurewebsites,代码行数:5,代码来源:Program.cs

示例7: Main

 // Please set the following connectionstring values in app.config
 // AzureJobsRuntime and AzureJobsData
 static void Main()
 {
     JobHost host = new JobHost();
     host.RunAndBlock();
 }
开发者ID:modulexcite,项目名称:webjobsvs,代码行数:7,代码来源:Program.cs

示例8: Main

 private static void Main()
 {
     var host = new JobHost();
     host.RunAndBlock();
 }
开发者ID:jvanderbiest,项目名称:Codit.AzureSearch.Sample,代码行数:5,代码来源:Program.cs

示例9: Main

 static void Main(string[] args)
 {
     var str = "DefaultEndpointsProtocol=https;AccountName=sychevigortestsite;AccountKey=dWDlc0DEcOvHufjiA2uZ7SjID5ZflmTeZvkhrEFIOQNFwqbZ3JNOjXgJ+GTYqvxhludZVVZBbTAQbnNTCBI/7g==";
     var host = new JobHost(str, str);
     host.RunAndBlock();
 }
开发者ID:deneha,项目名称:blog,代码行数:6,代码来源:Program.cs


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