diff --git a/RelayBotSample/Program.cs b/RelayBotSample/Program.cs index 5ed15a40..829cef24 100644 --- a/RelayBotSample/Program.cs +++ b/RelayBotSample/Program.cs @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Hosting; namespace Microsoft.PowerVirtualAgents.Samples.RelayBotSample { @@ -10,11 +10,14 @@ public class Program { public static void Main(string[] args) { - CreateWebHostBuilder(args).Build().Run(); + CreateHostBuilder(args).Build().Run(); } - public static IWebHostBuilder CreateWebHostBuilder(string[] args) => - WebHost.CreateDefaultBuilder(args) - .UseStartup(); + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup(); + }); } } diff --git a/RelayBotSample/README.md b/RelayBotSample/README.md index 925a3335..66d27652 100644 --- a/RelayBotSample/README.md +++ b/RelayBotSample/README.md @@ -6,7 +6,7 @@ This bot has been created based on [Bot Framework](https://dev.botframework.com) ## Prerequisites -- [.NET Core SDK](https://dotnet.microsoft.com/download) version 2.1 +- [.NET SDK](https://dotnet.microsoft.com/download) version 9.0 ```bash # determine dotnet version diff --git a/RelayBotSample/SampleBot.csproj b/RelayBotSample/SampleBot.csproj index cefada66..27b7ddf8 100644 --- a/RelayBotSample/SampleBot.csproj +++ b/RelayBotSample/SampleBot.csproj @@ -1,13 +1,12 @@ - netcoreapp2.1 + net9.0 latest - - + diff --git a/RelayBotSample/Startup.cs b/RelayBotSample/Startup.cs index c23b24c0..42ceefae 100644 --- a/RelayBotSample/Startup.cs +++ b/RelayBotSample/Startup.cs @@ -3,11 +3,11 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Mvc; using Microsoft.Bot.Builder; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; using Microsoft.PowerVirtualAgents.Samples.RelayBotSample.Bots; namespace Microsoft.PowerVirtualAgents.Samples.RelayBotSample @@ -24,7 +24,7 @@ public Startup(IConfiguration configuration) // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); + services.AddControllers(); // Create the Bot Framework Adapter with error handling enabled. services.AddSingleton(); @@ -44,7 +44,7 @@ public void ConfigureServices(IServiceCollection services) } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IHostingEnvironment env) + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { @@ -55,10 +55,19 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env) app.UseHsts(); } + // app.UseHttpsRedirection(); + app.UseDefaultFiles(); app.UseStaticFiles(); - app.UseMvc(); + app.UseRouting(); + + app.UseAuthorization(); + + app.UseEndpoints(endpoints => + { + endpoints.MapControllers(); + }); } } }