Add routing to web host (#4358)
This commit is contained in:
parent
d852e10293
commit
b2b16253af
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -222,6 +222,8 @@ namespace Microsoft.AspNetCore
|
||||||
new ConfigurationChangeTokenSource<HostFilteringOptions>(hostingContext.Configuration));
|
new ConfigurationChangeTokenSource<HostFilteringOptions>(hostingContext.Configuration));
|
||||||
|
|
||||||
services.AddTransient<IStartupFilter, HostFilteringStartupFilter>();
|
services.AddTransient<IStartupFilter, HostFilteringStartupFilter>();
|
||||||
|
|
||||||
|
services.AddRouting();
|
||||||
})
|
})
|
||||||
.UseIIS()
|
.UseIIS()
|
||||||
.UseIISIntegration();
|
.UseIISIntegration();
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Microsoft.AspNetCore.HostFiltering;
|
using Microsoft.AspNetCore.HostFiltering;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
@ -54,6 +55,17 @@ namespace Microsoft.AspNetCore.Tests
|
||||||
Assert.Contains("NewHost", options.AllowedHosts);
|
Assert.Contains("NewHost", options.AllowedHosts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void CreateDefaultBuilder_RegistersRouting()
|
||||||
|
{
|
||||||
|
var host = WebHost.CreateDefaultBuilder()
|
||||||
|
.Configure(_ => { })
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
var linkGenerator = host.Services.GetService(typeof(LinkGenerator));
|
||||||
|
Assert.NotNull(linkGenerator);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void CreateDefaultBuilder_RegistersEventSourceLogger()
|
public void CreateDefaultBuilder_RegistersEventSourceLogger()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue