コード例 #1
0
        public Action <IApplicationBuilder> Configure(Action <IApplicationBuilder> next)
        {
            try
            {
                // It doesn't look like much, but this preloads the key ring,
                // which in turn may load data from remote stores like Redis or Azure.
                var keyRing = _keyRingProvider.GetCurrentKeyRing();

                _logger.KeyRingWasLoadedOnStartup(keyRing.DefaultKeyId);
            }
            catch (Exception ex)
            {
                // This should be non-fatal, so swallow, log, and allow server startup to continue.
                // The KeyRingProvider may be able to try again on the first request.
                _logger.KeyRingFailedToLoadOnStartup(ex);
            }

            return(next);
        }
コード例 #2
0
    public Task StartAsync(CancellationToken token)
    {
        try
        {
            // It doesn't look like much, but this preloads the key ring,
            // which in turn may load data from remote stores like Redis or Azure.
            var keyRing = _keyRingProvider.GetCurrentKeyRing();

            _logger.KeyRingWasLoadedOnStartup(keyRing.DefaultKeyId);
        }
        catch (Exception ex)
        {
            // This should be non-fatal, so swallow, log, and allow server startup to continue.
            // The KeyRingProvider may be able to try again on the first request.
            _logger.KeyRingFailedToLoadOnStartup(ex);
        }

        return(Task.CompletedTask);
    }