Browse Source

Update the samples to use WebHost.CreateDefaultBuilder()

pull/500/head
Kévin Chalet 9 years ago
parent
commit
9fc00af0ab
  1. 1
      samples/Mvc.Client/Mvc.Client.csproj
  2. 24
      samples/Mvc.Client/Program.cs
  3. 8
      samples/Mvc.Client/Properties/launchSettings.json
  4. 1
      samples/Mvc.Server/Mvc.Server.csproj
  5. 24
      samples/Mvc.Server/Program.cs
  6. 8
      samples/Mvc.Server/Properties/launchSettings.json

1
samples/Mvc.Client/Mvc.Client.csproj

@ -7,6 +7,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="$(AspNetCoreVersion)" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="$(AspNetCoreVersion)" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="$(AspNetCoreVersion)" /> <PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="$(AspNetCoreVersion)" />

24
samples/Mvc.Client/Program.cs

@ -1,28 +1,16 @@
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore;
using Microsoft.Extensions.Configuration; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Logging;
namespace Mvc.Client namespace Mvc.Client
{ {
public static class Program public static class Program
{ {
public static void Main(string[] args) public static void Main(string[] args) =>
{ BuildWebHost(args).Run();
var configuration = new ConfigurationBuilder()
.AddEnvironmentVariables()
.AddCommandLine(args)
.Build();
var host = new WebHostBuilder() public static IWebHost BuildWebHost(string[] args) =>
.ConfigureLogging(options => options.AddConsole()) WebHost.CreateDefaultBuilder(args)
.ConfigureLogging(options => options.AddDebug())
.UseConfiguration(configuration)
.UseIISIntegration()
.UseKestrel()
.UseStartup<Startup>() .UseStartup<Startup>()
.Build(); .Build();
host.Run();
}
} }
} }

8
samples/Mvc.Client/Properties/launchSettings.json

@ -15,11 +15,13 @@
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
} }
}, },
"web": { "Mvc.Client": {
"commandName": "web", "commandName": "Project",
"launchBrowser": true,
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
} },
"applicationUrl": "http://localhost:53507/"
} }
} }
} }

1
samples/Mvc.Server/Mvc.Server.csproj

@ -28,6 +28,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="AspNet.Security.OAuth.Introspection" Version="$(AspNetContribOpenIdExtensionsVersion)" /> <PackageReference Include="AspNet.Security.OAuth.Introspection" Version="$(AspNetContribOpenIdExtensionsVersion)" />
<PackageReference Include="AspNet.Security.OAuth.Validation" Version="$(AspNetContribOpenIdExtensionsVersion)" /> <PackageReference Include="AspNet.Security.OAuth.Validation" Version="$(AspNetContribOpenIdExtensionsVersion)" />
<PackageReference Include="Microsoft.AspNetCore" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="$(AspNetCoreVersion)" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Twitter" Version="$(AspNetCoreVersion)" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.Twitter" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="$(AspNetCoreVersion)" /> <PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="$(AspNetCoreVersion)" />

24
samples/Mvc.Server/Program.cs

@ -1,28 +1,16 @@
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore;
using Microsoft.Extensions.Configuration; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Logging;
namespace Mvc.Server namespace Mvc.Server
{ {
public static class Program public static class Program
{ {
public static void Main(string[] args) public static void Main(string[] args) =>
{ BuildWebHost(args).Run();
var configuration = new ConfigurationBuilder()
.AddEnvironmentVariables()
.AddCommandLine(args)
.Build();
var host = new WebHostBuilder() public static IWebHost BuildWebHost(string[] args) =>
.ConfigureLogging(options => options.AddConsole()) WebHost.CreateDefaultBuilder(args)
.ConfigureLogging(options => options.AddDebug())
.UseConfiguration(configuration)
.UseIISIntegration()
.UseKestrel()
.UseStartup<Startup>() .UseStartup<Startup>()
.Build(); .Build();
host.Run();
}
} }
} }

8
samples/Mvc.Server/Properties/launchSettings.json

@ -15,11 +15,13 @@
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
} }
}, },
"web": { "Mvc.Server": {
"commandName": "web", "commandName": "Project",
"launchBrowser": true,
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
} },
"applicationUrl": "http://localhost:54540/"
} }
} }
} }
Loading…
Cancel
Save