Botframework发布到天蓝色错误。 “尚无此类主机”

时间:2019-08-22 01:17:00

标签: c# azure botframework facebook-messenger

你好,我将我的漫游器发布为azure,并在Messenger上对其进行测试时出现此错误。我在我的azure应用程序上下载了发布设置,并通过Visual Studio将其导入到机器人中。我之前已经做过很多次,但这是我第一次发布最新的botframework设计。

该机器人在包括luis,qnaMaker和调度服务在内的机器人模拟器上运行良好。

我看到了this question,但我的appsettings.json中的LuisAPIHostName已设置为region。

任何想法如何解决这个问题?谢谢 enter image description here 由于此代码,我可以看到错误

public class AdapterWithErrorHandler : BotFrameworkHttpAdapter
{
    private const string ErrorMsgText = "Sorry, it looks like something went wrong.";

    public AdapterWithErrorHandler(IConfiguration configuration, ILogger<BotFrameworkHttpAdapter> logger, ConversationState conversationState = null)
        : base(configuration, logger)
    {
        OnTurnError = async (turnContext, exception) =>
        {
            // Log any leaked exception from the application.
            logger.LogError($"Exception caught : {exception.Message}");

            // Send a catch-all apology to the user.
            var errorMessage = MessageFactory.Text(ErrorMsgText + exception.Message, ErrorMsgText, InputHints.ExpectingInput);
            await turnContext.SendActivityAsync(errorMessage);

我的应用设置:

   {
  "Logging": {
    "LogLevel": {
      "Default": "Warning"
    }
  },

  "MicrosoftAppId": "",
  "MicrosoftAppPassword": "",

  "DispatchLuisAppId": DispatchAppId,
  "DispatchLuisAPIKey": DispatchAPIKey,
  "DispatchLuisAPIHostName": "southeastasia",

  "LuisAppId": LuisAppId,
  "LuisAPIKey": LuisAPIKey,
  "LuisAPIHostName": "southeastasia",

  "QnAKnowledgebaseId": QnaMakerKBId,
  "QnAEndpointKey": QnaMAkerEndpointKey,
  "QnAEndpointHostName": QnaMakerEndpointHostName,
  "AllowedHosts": "*"
}

botServices:

 public class BotServices : IBotServices
{
    public BotServices(IConfiguration configuration)
    {
        DispatchService = new LuisRecognizer(new LuisApplication(
        configuration["DispatchLuisAppId"],
        configuration["DispatchLuisAPIKey"],
        $"https://{configuration["DispatchLuisAPIHostName"]}.api.cognitive.microsoft.com"),
        new LuisPredictionOptions { IncludeAllIntents = true, IncludeInstanceData = true },
        true);

        LuisService = new LuisRecognizer(new LuisApplication(
        configuration["LuisAppId"],
        configuration["LuisAPIKey"],
        $"https://{configuration["LuisAPIHostName"]}.api.cognitive.microsoft.com"),
        new LuisPredictionOptions { IncludeAllIntents = true, IncludeInstanceData = true },
        true);

        QnaService = new QnAMaker(new QnAMakerEndpoint
        {
            KnowledgeBaseId = configuration["QnAKnowledgebaseId"],
            EndpointKey = configuration["QnAEndpointKey"],
            Host = configuration["QnAEndpointHostName"]
        });
    }

    public LuisRecognizer DispatchService { get; private set; }
    public LuisRecognizer LuisService { get; private set; }
    public QnAMaker QnaService { get; private set; }
}

调度键和端点 enter image description here

LUIS键和端点 enter image description here

wwwroot enter image description here

具有工作luis,dispatch和qna的

仿真器(顺便说一句,该错误仅在我单击仿真器中的“跟踪”时出现) enter image description here

  

更新

我将应用程序设置更改为

  "DispatchLuisAPIHostName": "southeastasia.api.cognitive.microsoft.com",

和botservice到

            $"https://{configuration["DispatchLuisAPIHostName"]}"),

在Messenger中,它现在正在答复,但是检测到我键入为“取消”意图的所有内容。我添加了代码以查看意图,您可以看到模拟器和Messenger的区别。

enter image description here

我在模拟器上键入了相同的内容,但是luis,qna和dispatch正常工作。

![enter image description here

0 个答案:

没有答案