| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | using CoreWCF.Configuration; |
| | | 5 | | using Microsoft.AspNetCore.Builder; |
| | | 6 | | using Microsoft.Extensions.DependencyInjection; |
| | | 7 | | using Microsoft.Extensions.Logging; |
| | | 8 | | |
| | | 9 | | namespace CoreWCF.Channels |
| | | 10 | | { |
| | | 11 | | internal class HttpTransportServiceBuilder : ITransportServiceBuilder |
| | | 12 | | { |
| | | 13 | | private bool _configured = false; |
| | 434 | 14 | | private readonly object _lock = new object(); |
| | | 15 | | |
| | | 16 | | public void Configure(IApplicationBuilder app) |
| | | 17 | | { |
| | 382 | 18 | | ILogger<HttpTransportServiceBuilder> logger = app.ApplicationServices.GetRequiredService<ILogger<HttpTranspo |
| | 382 | 19 | | if (!_configured) |
| | | 20 | | { |
| | 382 | 21 | | lock (_lock) |
| | | 22 | | { |
| | 382 | 23 | | if (!_configured) |
| | | 24 | | { |
| | 382 | 25 | | ConfigureCore(app, logger); |
| | 382 | 26 | | _configured = true; |
| | | 27 | | } |
| | 382 | 28 | | } |
| | | 29 | | } |
| | 382 | 30 | | } |
| | | 31 | | |
| | | 32 | | private void ConfigureCore(IApplicationBuilder app, ILogger logger) |
| | | 33 | | { |
| | 382 | 34 | | logger.LogDebug("Adding ServiceModelHttpMiddleware to app builder"); |
| | 382 | 35 | | app.UseMiddleware<ServiceModelHttpMiddleware>(app); |
| | 382 | 36 | | } |
| | | 37 | | } |
| | | 38 | | } |