コード例 #1
0
        public static IMultiplexedConnectionBuilder UseHttp3Server <TContext>(this IMultiplexedConnectionBuilder builder, ServiceContext serviceContext, IHttpApplication <TContext> application, HttpProtocols protocols) where TContext : notnull
        {
            var middleware = new Http3ConnectionMiddleware <TContext>(serviceContext, application);

            return(builder.Use(next =>
            {
                return middleware.OnConnectionAsync;
            }));
        }
コード例 #2
0
        /// <summary>
        /// Emits verbose logs for bytes read from and written to the connection.
        /// </summary>
        /// <returns>
        /// The <see cref="ListenOptions"/>.
        /// </returns>
        public static ListenOptions UseConnectionLogging(this ListenOptions listenOptions, string?loggerName)
        {
            var loggerFactory = listenOptions.KestrelServerOptions.ApplicationServices.GetRequiredService <ILoggerFactory>();
            var logger        = loggerName == null?loggerFactory.CreateLogger <LoggingConnectionMiddleware>() : loggerFactory.CreateLogger(loggerName);

            listenOptions.Use(next => new LoggingConnectionMiddleware(next, logger).OnConnectionAsync);

            IMultiplexedConnectionBuilder multiplexedConnectionBuilder = listenOptions;

            multiplexedConnectionBuilder.Use(next => new LoggingMultiplexedConnectionMiddleware(next, logger).OnConnectionAsync);

            return(listenOptions);
        }