3
3
4
4
using Microsoft . AspNetCore . Builder ;
5
5
using Microsoft . AspNetCore . Hosting ;
6
- using Microsoft . AspNetCore . Mvc ;
7
6
using Microsoft . Bot . Builder ;
8
7
using Microsoft . Bot . Builder . Integration . AspNet . Core ;
8
+ using Microsoft . Bot . Connector . Authentication ;
9
9
using Microsoft . Extensions . Configuration ;
10
10
using Microsoft . Extensions . DependencyInjection ;
11
+ using Microsoft . Extensions . Hosting ;
11
12
using Microsoft . PowerVirtualAgents . Samples . RelayBotSample . Bots ;
12
13
13
14
namespace Microsoft . PowerVirtualAgents . Samples . RelayBotSample
@@ -24,10 +25,13 @@ public Startup(IConfiguration configuration)
24
25
// This method gets called by the runtime. Use this method to add services to the container.
25
26
public void ConfigureServices ( IServiceCollection services )
26
27
{
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 > ( ) ;
28
32
29
33
// Create the Bot Framework Adapter with error handling enabled.
30
- services . AddSingleton < IBotFrameworkHttpAdapter , AdapterWithErrorHandler > ( ) ;
34
+ services . AddSingleton < CloudAdapter , AdapterWithErrorHandler > ( ) ;
31
35
32
36
// Create the bot as a transient. In this case the ASP Controller is expecting an IBot.
33
37
services . AddSingleton < IBot , RelayBot > ( ) ;
@@ -44,7 +48,7 @@ public void ConfigureServices(IServiceCollection services)
44
48
}
45
49
46
50
// 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 )
48
52
{
49
53
if ( env . IsDevelopment ( ) )
50
54
{
@@ -55,10 +59,19 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
55
59
app . UseHsts ( ) ;
56
60
}
57
61
62
+ // app.UseHttpsRedirection();
63
+
58
64
app . UseDefaultFiles ( ) ;
59
65
app . UseStaticFiles ( ) ;
60
66
61
- app . UseMvc ( ) ;
67
+ app . UseRouting ( ) ;
68
+
69
+ app . UseAuthorization ( ) ;
70
+
71
+ app . UseEndpoints ( endpoints =>
72
+ {
73
+ endpoints . MapControllers ( ) ;
74
+ } ) ;
62
75
}
63
76
}
64
77
}
0 commit comments