.net core bot配置不包含id为“basic bot luis”的“luis”服务类型。(.NET核心)

.net core bot配置不包含id为“basic bot luis”的“luis”服务类型。(.NET核心),.net-core,botframework,.net Core,Botframework,当我尝试创建一个基本机器人时 适用于VS版本4.0.6.6的Bot Builder V4 SDK模板 VS 2017社区 .NET核心2.1 更新了NuGet Manager中的软件包(Microsoft.AspNetCore.All除外,因为它需要.NET 2.2预览版) 在构建和运行之后。我尝试使用Bot模拟器,打开.Bot配置文件。 当我向机器人发送消息时。我在控制台上发现了错误 Microsoft.AspNetCore.Diagnostics.DeveloperExceptionP

当我尝试创建一个基本机器人时

  • 适用于VS版本4.0.6.6的Bot Builder V4 SDK模板
  • VS 2017社区
  • .NET核心2.1
  • 更新了NuGet Manager中的软件包(Microsoft.AspNetCore.All除外,因为它需要.NET 2.2预览版)
在构建和运行之后。我尝试使用Bot模拟器,打开.Bot配置文件。 当我向机器人发送消息时。我在控制台上发现了错误

 Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[0]
      An unhandled exception has occurred while executing the request
System.InvalidOperationException: The bot configuration does not contain a service type of `luis` with the id `basic-bot-LUIS`.
   at BotBasicV4.BasicBot..ctor(BotServices services, UserState userState, ConversationState conversationState, ILoggerFactory loggerFactory) in D:\workspace\AI_INTERN_BOT\BotBasicV4\BotBasicV4\BasicBot.cs:line 61
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitTransient(TransientCallSite transientCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
   at Microsoft.Bot.Builder.Integration.AspNet.Core.Handlers.BotMessageHandlerBase.HandleAsync(HttpContext httpContext) in D:\a\1\s\libraries\integration\Microsoft.Bot.Builder.Integration.AspNet.Core\BotMessageHandlerBase.cs:line 63
   at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[0]
通过Bot Builder V4(4.0.6.6)构建的Echo Bot V4正常。但是
Basic Bot
在我第一次运行时出错(无需修改任何内容)


有人能解释一下为什么会发生这种情况吗?

请阅读生成的项目中的README.md文件。您将在这里找到一些关于设置机器人将使用的LUIS应用程序的指导。 您需要设置LUI,然后在BotConfiguration.bot的“services”数组中添加这样的配置

{
  "type": "luis",
  "name": "basic-bot-LUIS",
  "region": "westus",
  "appId": "<your app id>",
  "authoringKey": "<your authoring key>",
  "version": "0.1",
  "id": "basic-bot-LUIS"
}
{
“类型”:“路易斯”,
“名称”:“基本机器人路易斯”,
“区域”:“韦斯特斯”,
“appId”:“,
“authoringKey”:“,
“版本”:“0.1”,
“id”:“基本机器人LUIS”
}

Visual Studio模板无法创建所需的文件:这将导致此错误。请注意,Radek的评论仍然有效;我需要两个更改才能使其正常工作(即向BotConfiguration.bot添加一个节)。

Radek和markau的注释是正确的,因此为了解决这个问题,我将该节添加到Radek注释的BotConfiguration.bot中,并使用以下代码在解决方案的根目录中创建了一个BasicBot.bot文件

{
  "name": "basic-bot-LUIS",
  "services": [
    {
      "type": "luis",
      "name": "basic-bot-LUIS",
      "region": "westus",
      "appId": "<your appID>",
      "authoringKey": "<your authoringKey>",
      "version": "0.1",
      "id": "basic-bot-LUIS"
    }
  ],
  "padlock": "",
  "version": "2.0"
}
{
“名称”:“基本机器人路易斯”,
“服务”:[
{
“类型”:“路易斯”,
“名称”:“基本机器人路易斯”,
“区域”:“韦斯特斯”,
“appId”:“,
“authoringKey”:“,
“版本”:“0.1”,
“id”:“基本机器人LUIS”
}
],
“挂锁”:“,
“版本”:“2.0”
}

我阅读了前面的所有答案,但仍然发现README.MD文件对我需要做什么有点不清楚,以便让Bot Builder基本Bot V4项目开箱即用

下面是BotConfiguration.bot文件在编译和运行后的样子:

{
  "name": "Bot_Builder_Basic_Bot_V4",
  "services": [
    {
      "type": "endpoint",
      "name": "development",
      "endpoint": "http://localhost:3978/api/messages",
      "appPassword": "",
      "version": "0.1",
      "id": "1"
    },
    {
      "type": "luis",
      "name": "basic-bot-LUIS",
      "region": "westus",
      "appId": "<APP ID>",
      "authoringKey": "<AUTHORING KEY>",
      "version": "0.1",
      "id": "basic-bot-LUIS"
    }
  ],
  "padlock": "",
  "version": "2.0"
}
{
“名称”:“Bot\u Builder\u Basic\u Bot\u V4”,
“服务”:[
{
“类型”:“端点”,
“名称”:“发展”,
“端点”:http://localhost:3978/api/messages",
“appPassword”:“”,
“版本”:“0.1”,
“id”:“1”
},
{
“类型”:“路易斯”,
“名称”:“基本机器人路易斯”,
“区域”:“韦斯特斯”,
“appId”:“网站,在创建帐户和应用程序后:


  • 基本机器人程序的说明可在此处找到: