Skip to content
This repository was archived by the owner on Jun 17, 2024. It is now read-only.
This repository was archived by the owner on Jun 17, 2024. It is now read-only.

Unexpected behavior after implementing TableBotDataStore #28

Open
@waynehsmith

Description

@waynehsmith

Install Azure Storage Emulator and check operation

Steps to reproduce using SampleAADv2Bot:

  1. Install NuGet Package Autofac.WebApi2
  2. Install NuGet package Microsoft.BotBuilder.Azure

in Global.asax.cs

  1. Add the following after the Application Start method
    private void ConfigureBotTableStorage()
    {
    string tableName = "UserStateDev";

         TableBotDataStore store = new TableBotDataStore(CloudStorageAccount.DevelopmentStorageAccount, tableName);
         
    
         var builder = new ContainerBuilder();
    
         builder.Register(c => store)
             .Keyed<IBotDataStore<BotData>>(AzureModule.Key_DataStore)
             .AsSelf()
             .SingleInstance();
    
         builder
             .Register(c =>
             {
                 return new CachingBotDataStore(store, CachingBotDataStoreConsistencyPolicy.ETagBasedConsistency);
             })
             .As<IBotDataStore<BotData>>()
             .AsSelf()
             .InstancePerLifetimeScope();
    
         // Get your HttpConfiguration.
         var config = GlobalConfiguration.Configuration;
    
         // Register your Web API controllers.
         builder.RegisterApiControllers(Assembly.GetExecutingAssembly());
    
         // OPTIONAL: Register the Autofac filter provider.
         builder.RegisterWebApiFilterProvider(config);
    
         // Set the dependency resolver to be Autofac.
         //var container = builder.Build();
         builder.Update(Conversation.Container);
         config.DependencyResolver = new AutofacWebApiDependencyResolver(Conversation.Container);
       @@}
    
  2. Before the line
    GlobalConfiguration.Configure(WebApiConfig.Register);
    insert the line
    ConfigureBotTableStorage();

  3. Save and compile

  4. Connect to the bot on http://localhost:3978/api/messages with the Bot Framework Channel Emulator

  5. Send logon to the bot inthe emulator

  6. Click the Authentication Required link in the emulator

  7. Log in using a Microsoft account in the browser window that opens

  8. Copy the magic number to send back to the bot

Expected behavior

Bot prompts for the magic number

Actual behavior

Bot displays sign-in card again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions