Created
March 2, 2022 23:05
-
-
Save sunnyy02/0fc18e7973dae1651d1ed3b27f51aedb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Startup | |
{ | |
// This method gets called by the runtime. Use this method to add services to the container. | |
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddHttpClient().AddControllers().AddNewtonsoftJson(); | |
// Create the Bot Framework Authentication to be used with the Bot Adapter. | |
services.AddSingleton<BotFrameworkAuthentication, ConfigurationBotFrameworkAuthentication>(); | |
// Create the Bot Adapter with error handling enabled. | |
services.AddSingleton<IBotFrameworkHttpAdapter, AdapterWithErrorHandler>(); | |
// Create the storage we'll be using for User and Conversation state. (Memory is great for testing purposes.) | |
services.AddSingleton<IStorage, MemoryStorage>(); | |
// Create the User state. (Used in this bot's Dialog implementation.) | |
services.AddSingleton<UserState>(); | |
// Create the Conversation state. (Used by the Dialog system itself.) | |
services.AddSingleton<ConversationState>(); | |
} | |
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. | |
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) | |
{ | |
if (env.IsDevelopment()) | |
{ | |
app.UseDeveloperExceptionPage(); | |
} | |
app.UseDefaultFiles() | |
.UseStaticFiles() | |
.UseWebSockets() | |
.UseRouting() | |
.UseAuthorization() | |
.UseEndpoints(endpoints => | |
{ | |
endpoints.MapControllers(); | |
}); | |
// app.UseHttpsRedirection(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment