BotFramework: 'State size exceeded configured

2019-03-01 07:44发布

问题:

I'm devloping a bot and whenever I PostAsync herocards (50 hero cards) in a formflow, in the end it gives me an error message: 'State size exceeded configured limit.' from Microsoft.Bot.Connector.DLL

Error happens when try to setPrivateConversationData Below the error on Emulator:

  "key": {
    "channelId": "emulator",
    "conversationId": "i99caeb8n2h7",
    "userId": "default-user"
  },
  "state": {
    "eTag": "1506952139325",
    "data": {
      "ResumptionContext": {
        "locale": "en-US",
        "isTrustedServiceUrl": true
      },
      "DialogState": "H4sIAAAAAAAEAOx9B2AjWX........",
      "ServiceUrl": "http://localhost:1460"
    }
  }
}

Response:

{
  "error": {
    "code": "MessageSizeTooBig",
    "message": "State size exceeded configured limit."
  }
}

Thank you everyone

回答1:

Per the docs, there is a limit on the amount of data you can store using the default State capabilities. Each state store (i.e., user, conversation, and private bot data bag) may contain up to 64kb of data.

You will have to store less info or to provide your own storage mechanism.

The following article shows how to manage state data using CosmosDb: https://docs.microsoft.com/en-us/bot-framework/dotnet/bot-builder-dotnet-state-azure-cosmosdb