我一直在使用context.setvalue(); 和context.TryGetvalue(); 在Bot Framework中存储和接收数据到不同的存储.
我想知道如何从MessageController.cs访问这些值
已经尝试过创建一个New对象,它对我不起作用.
我在微软团队上发布了我的机器人.现在我想要包含一个功能,用户可以将文件作为附件上传,bot会将其上传到blob存储,如何在bot框架中处理?
我正在使用Azure Bot服务开发Microsoft Bot,因为它想要为QA,Dev,Staging设置不同的环境或插槽,就像我们在azure app服务中一样.
在设置中我没有找到"部署插槽"选项,但在设置下每个设置都有"插槽设置"复选框,这是否意味着我们是否可以在Azure Bot服务中配置插槽,还是必须为每个环境创建多个Bot服务资源?
我想在有人连接到我的机器人时显示欢迎信息.我在github上使用了demo-ContosoFlowers示例中的技术(https://github.com/Microsoft/BotBuilder-Samples/tree/master/CSharp/demo-ContosoFlowers),它在Bot框架模拟器中运行良好,但不是在Skype或Facebook Messenger中.具体来说,MessageController.HandleSystemMessage中的此代码不会触发:
else if (message.Type == ActivityTypes.ConversationUpdate)
{
if (message.MembersAdded.Any(o => o.Id == message.Recipient.Id))
{
var reply = message.CreateReply(Resources.RootDialog_Welcome_Message);
ConnectorClient connector = new ConnectorClient(new Uri(message.ServiceUrl));
await connector.Conversations.ReplyToActivityAsync(reply);
}
}
Run Code Online (Sandbox Code Playgroud)
有谁知道如何正确地做到这一点?
下载的bot模拟器和vs模板代码,如https://docs.microsoft.com/en-us/bot-framework/resources-tools-downloads中所述.
在我的Windows 10计算机上启动具有管理员权限的VS 2015 [版本:14 Update 3]以及具有相同最终结果的VS 2017 [版本:15.2]之后创建了一个新的僵尸程序应用程序(版本:1703;操作系统构建:16199.1000) .
更新了所有nuget包.
按F5运行应用程序.我收到以下错误:
'/'应用程序中的服务器错误.
指定的参数超出了有效值的范围.参数名称:site
描述:执行当前Web请求期间发生未处理的异常.请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息.
异常详细信息:System.ArgumentOutOfRangeException:指定的参数超出了有效值的范围.参数名称:site
来源错误:
在执行当前Web请求期间生成了未处理的异常.可以使用下面的异常堆栈跟踪来识别有关异常的起源和位置的信息.
堆栈跟踪:
[ArgumentOutOfRangeException:指定的参数超出了有效值的范围.参数名称:site] System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags,PolicyLevel policyLevel,Exception appDomainCreationException)+280
[HttpException(0x80004005):指定的参数超出了有效值的范围.参数名称:site] System.Web.HttpRuntime.FirstRequestInit(HttpContext context)+10041024 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context)+95 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr,HttpContext context)+254
应用程序事件日志包含以下信息:
事件代码:3005事件消息:发生了未处理的异常.活动时间:5/24/2017 11:36:28 PM活动时间(UTC):5/25/2017 6:36:28 AM活动编号:9914b02cd15f4282b9043b1f70097b3e活动顺序:1活动开始:1活动详情代码:0
应用程序信息:应用程序域:/ LM/W3SVC/2/ROOT-1-131401677887853236信任级别:
应用程序虚拟路径:/应用程序路径:c:\ users \用户A\documents\visual studio 2017\Projects\MyFirstBotApp\MyFirstBotApp\Machine名称:DESKTOP-BQ93HFB
进程信息:进程ID:14320进程名称:iisexpress.exe帐户名:DESKTOP-BQ93HFB\User A
异常信息:异常类型:ArgumentOutOfRangeException异常消息:指定的参数超出了有效值的范围.参数名称:System.Web.Configuration.WebConfigurationHost.InitForConfiguration(String&locationSubPath,String&configPath,String&locationConfigPath,IInternalConfigRoot configRoot,Object [] hostInitConfigurationParams)中的站点,位于System.Configuration.Configuration..ctor(String locationSubPath,Type typeConfigHost,Object [在System.Web.Configuration.WebConfigurationHost.OpenConfiguration的System.Configuration.Internal.InternalConfigConfigurationFactory.System.Configuration.InternalConfigConfigurationFforyConfigurationFactory.Create(Type typeConfigHost,Object [] hostInitConfigurationParams)中的(hostInitConfigurationParams)(WebLevel webLevel,ConfigurationFileMap文件映射,VirtualPath路径, System.Web.Configuration.WebConfigurationManager.OpenWebConfigurationImpl中的String site,String locationSubPath,String server,String userName,String password,IntPtr tokenHandle(WebLevel webLevel,ConfigurationFileMap fileMap,String path,String site,String locationSubPath,String server,String u System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags,PolicyLevel policyLevel,Exception appDomainCreationException)的System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironment(String appId,IApplicationHost appHost,HostingEnvironmentParameters …
iis-express visual-studio-2015 botframework visual-studio-2017
此代码在此网站上https://www.microsoft.com/reallifecode/2017/01/10/creating-a-single-bot-service-to-support-multiple-bot-applications/#comment-148
我是新的僵尸框架,并在C#编写了一个机器人,并希望为网页上显示的n个用户部署相同的机器人.但是给定的代码是在Node.js.有没有办法在C#asp.net中编写相同的代码
var express = require('express');
var builder = require('botbuilder');
var port = process.env.PORT || 3978;
var app = express();
// a list of client ids, with their corresponding
// appids and passwords from the bot developer portal.
// get this from the configuration, a remote API, etc.
var customersBots = [
{ cid: 'cid1', appid: '', passwd: '' },
{ cid: 'cid2', appid: '', passwd: '' },
{ cid: 'cid3', appid: '', passwd: '' },
]; …Run Code Online (Sandbox Code Playgroud) 我有一些代码让机器人在启动时发送消息(字符串)。
但是,不是像您在下面的代码中看到的那样发送文本。我想弄清楚在这种情况下您将如何发送自适应卡。我之前从 RootDialog 发送了一张卡片,但不是从 MessageController.cs 发送的。任何方向在这里都会很棒!
else if (message.Type == ActivityTypes.ConversationUpdate)
{
// Handle conversation state changes, like members being added and removed
// Use Activity.MembersAdded and Activity.MembersRemoved and Activity.Action for info
// Not available in all channels
IConversationUpdateActivity iConversationUpdated = message as IConversationUpdateActivity;
if (iConversationUpdated != null)
{
ConnectorClient connector = new ConnectorClient(new System.Uri(message.ServiceUrl));
foreach (var member in iConversationUpdated.MembersAdded ?? System.Array.Empty<ChannelAccount>())
{
// if the bot is added, then
if (member.Id == iConversationUpdated.Recipient.Id)
{
var reply = ((Activity)iConversationUpdated).CreateReply($"WELCOME MESSAGE …Run Code Online (Sandbox Code Playgroud) 我正在使用MS bot生成器node.js SDK。在最近的更新之一之前,重试提示时,它正在向用户发送与重试提示相同的消息文本。
但是,现在它正在系统中发送默认文本消息,即“我听不懂,请重试”。但是,我希望重试提示始终与原始消息相同,并且如果可能的话,希望将其全局应用,这意味着我不想为发送给用户的每个提示自定义重试提示。
我一直在环顾四周,但找不到方法。
谢谢!
在 QnA Maker API 中,当没有找到结果时,它会返回一些默认消息,或者我们可以更改该消息,但是我想在没有结果时运行一个函数/方法。下面是代码。
public QnaDialog(): base(
new QnAMakerService(new QnAMakerAttribute(ConfigurationManager.AppSettings["QnaSubscriptionKey"],
ConfigurationManager.AppSettings["QnaKnowledgebaseId"], "Hmm, I wasn't able to find any relevant content. Can you try asking in a different way? or try with typing help.", 0.5)))
{
//this is what i want to call, this is working but **i am not able to get query text here**
SendEmail email = new SendEmail();
email.SendEmailtoAdmin("Query_Text", "Email ID");
}
Run Code Online (Sandbox Code Playgroud)