상속: IDisposable
예제 #1
0
        internal static async Task <bool> DelayUntilHostReady(WebHostResolver resolver)
        {
            // need to ensure the host startup has been initiated
            var manager = resolver.GetWebScriptHostManager();
            var tIgnore = manager.EnsureHostStarted(CancellationToken.None);

            // wait for the host to get into a running state
            return(await manager.DelayUntilHostReady(throwOnFailure : false));
        }
        internal static void Initialize(ContainerBuilder builder, WebHostSettings settings)
        {
            // register the resolver so that it is disposed when the container
            // is disposed
            var webHostResolver = new WebHostResolver();

            builder.RegisterInstance(webHostResolver);

            // these services are externally owned by the WebHostResolver, and will be disposed
            // when the resolver is disposed
            builder.Register <SecretManager>(ct => webHostResolver.GetSecretManager(settings)).ExternallyOwned();
            builder.Register <WebScriptHostManager>(ct => webHostResolver.GetWebScriptHostManager(settings)).ExternallyOwned();
            builder.Register <WebHookReceiverManager>(ct => webHostResolver.GetWebHookReceiverManager(settings)).ExternallyOwned();
        }
        internal static async Task <bool> DelayUntilHostReady(WebHostResolver resolver)
        {
            if (DelayRequests)
            {
                // delay until we're ready to start processing requests
                await Utility.DelayAsync(ScriptConstants.HostTimeoutSeconds, ScriptConstants.HostPollingIntervalMilliseconds, () =>
                {
                    return(DelayRequests);
                });
            }

            // need to ensure the host startup has been initiated
            var manager = resolver.GetWebScriptHostManager();
            var tIgnore = manager.EnsureHostStarted(CancellationToken.None);

            // wait for the host to get into a running state
            return(await manager.DelayUntilHostReady(throwOnFailure : false));
        }
예제 #4
0
 internal static void Initialize(ContainerBuilder builder, WebHostSettings settings)
 {
     builder.Register <SecretManager>(ct => WebHostResolver.GetSecretManager(settings)).ExternallyOwned();
     builder.Register <WebScriptHostManager>(ct => WebHostResolver.GetWebScriptHostManager(settings)).ExternallyOwned();
     builder.Register <WebHookReceiverManager>(ct => WebHostResolver.GetWebHookReceiverManager(settings)).ExternallyOwned();
 }