Microsoft.Azure.WebJobs.Script.ScriptHostManager.Stop C# (CSharp) Метод

Stop() публичный Метод

public Stop ( ) : void
Результат void
        public void Stop()
        {
            StopAsync().GetAwaiter().GetResult();
        }

Usage Example

        public async Task UpdateFileAndRestart()
        {
            Random r = new Random();

            CancellationTokenSource cts = new CancellationTokenSource();

            var fixture = new NodeEndToEndTests.TestFixture();
            var blob1 = UpdateOutputName("testblob", "first", fixture);

            await fixture.Host.StopAsync();
            var config = fixture.Host.ScriptConfig;            

            using (var manager = new ScriptHostManager(config))
            {
                // Background task to run while the main thread is pumping events at RunAndBlock(). 
                Thread t = new Thread(_ =>
                   {
                       // Wait for initial execution.
                       TestHelpers.Await(() =>
                       {
                           return blob1.Exists();
                       }, timeout: 10 * 1000).Wait();

                       // This changes the bindings so that we now write to blob2
                       var blob2 = UpdateOutputName("first", "second", fixture);

                       // wait for newly executed
                       TestHelpers.Await(() =>
                       {
                           return blob2.Exists();
                       }, timeout: 10 * 1000).Wait();

                       manager.Stop();
                   });
                t.Start();                           

                manager.RunAndBlock(cts.Token);

                t.Join();
            }
        }