You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure Bot Service机器人状态保存技术疑问:对话数据生命周期等

Questions about Azure Bot Service .NET State Management for Web Chat Channel

I've reviewed the official Microsoft documentation on Azure Bot Service .NET State Management, and I have the following questions regarding bot state storage, specifically for bots deployed via the Web Chat channel:

  1. What is the lifecycle of stored data? For example, when I save data using the context.ConversationData.SetValue(..) method, will this data be cleared after the conversation ends (such as when the user refreshes the page)?
  2. The From property in the Activity object includes Id and Name fields. I have follow-up questions to add later.

Answer

Let me break this down for you based on how Azure Bot Service handles state for the Web Chat channel:

1. Lifecycle of ConversationData

First, ConversationData is tied directly to a specific conversation ID. For the Web Chat channel, this conversation ID is linked to the user's browser session context.

  • If a user just refreshes the page without closing the browser or clearing session-related storage (like cookies), the existing conversation ID usually stays intact. In this case, the data saved via context.ConversationData.SetValue(..) won't be cleared—you’ll still be able to access it in the refreshed session.
  • If the user closes the browser, clears their browser’s cache/cookies, or starts a new browser instance, a new conversation ID will be generated. At that point, the old ConversationData becomes inaccessible because it’s bound to the original conversation ID.

Additionally, Azure Bot Service has a default expiration policy for state storage. By default, conversation data expires after roughly 30 days, but you can adjust this timeline by configuring the state service to fit your needs. You can also manually delete data using methods like context.ConversationData.Clear() if you want to remove it before the automatic expiration.

2. Follow-up Questions on Activity.From's Id and Name

Since you mentioned you have follow-up questions about the Id and Name fields in the From property, feel free to share specific details whenever you’re ready. For example, questions about how the Id is generated in Web Chat, whether Name can be customized, or how these values behave across different user interactions would help provide a targeted, accurate answer.


内容的提问来源于stack exchange,提问作者user3740951

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 08:11:49