33
44using Microsoft . AspNetCore . Builder ;
55using Microsoft . AspNetCore . Hosting ;
6- using Microsoft . AspNetCore . Mvc ;
76using Microsoft . Bot . Builder ;
87using Microsoft . Bot . Builder . Integration . AspNet . Core ;
8+ using Microsoft . Bot . Connector . Authentication ;
99using Microsoft . Extensions . Configuration ;
1010using Microsoft . Extensions . DependencyInjection ;
11+ using Microsoft . Extensions . Hosting ;
1112using Microsoft . PowerVirtualAgents . Samples . RelayBotSample . Bots ;
1213
1314namespace Microsoft . PowerVirtualAgents . Samples . RelayBotSample
@@ -24,10 +25,13 @@ public Startup(IConfiguration configuration)
2425 // This method gets called by the runtime. Use this method to add services to the container.
2526 public void ConfigureServices ( IServiceCollection services )
2627 {
27- services . AddMvc ( ) . SetCompatibilityVersion ( CompatibilityVersion . Version_2_1 ) ;
28+ services . AddControllers ( ) ;
29+
30+ // Create the Bot Framework Authentication to be used with the Bot Adapter.
31+ services . AddSingleton < BotFrameworkAuthentication , ConfigurationBotFrameworkAuthentication > ( ) ;
2832
2933 // Create the Bot Framework Adapter with error handling enabled.
30- services . AddSingleton < IBotFrameworkHttpAdapter , AdapterWithErrorHandler > ( ) ;
34+ services . AddSingleton < CloudAdapter , AdapterWithErrorHandler > ( ) ;
3135
3236 // Create the bot as a transient. In this case the ASP Controller is expecting an IBot.
3337 services . AddSingleton < IBot , RelayBot > ( ) ;
@@ -44,7 +48,7 @@ public void ConfigureServices(IServiceCollection services)
4448 }
4549
4650 // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
47- public void Configure ( IApplicationBuilder app , IHostingEnvironment env )
51+ public void Configure ( IApplicationBuilder app , IWebHostEnvironment env )
4852 {
4953 if ( env . IsDevelopment ( ) )
5054 {
@@ -55,10 +59,19 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
5559 app . UseHsts ( ) ;
5660 }
5761
62+ // app.UseHttpsRedirection();
63+
5864 app . UseDefaultFiles ( ) ;
5965 app . UseStaticFiles ( ) ;
6066
61- app . UseMvc ( ) ;
67+ app . UseRouting ( ) ;
68+
69+ app . UseAuthorization ( ) ;
70+
71+ app . UseEndpoints ( endpoints =>
72+ {
73+ endpoints . MapControllers ( ) ;
74+ } ) ;
6275 }
6376 }
6477}
0 commit comments