Botframework publish to azure error. “No such host is known”

六眼飞鱼酱① 提交于 2019-12-11 15:02:49

问题


Hello i publish my bot to azure and have this error when i tested it on messenger. I downloaded the publish settings on my azure app and import it to the bot via Visual Studio. I have done this many times before but this is my first time publishing on the latest botframework design.

This bot is working fine on bot emulator including luis, qnaMaker and dispatch services.

I saw this question but LuisAPIHostName in my appsettings.json is already set to region.

Any idea how to solve this? Thank you I can see the error because of this code

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);

My appsettings:

   {
  "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; }
}

Dispatch keys and endpoint

LUIS keys and endpoint

wwwroot

emulator with working luis,dispatch and qna(btw the error only appears when i click "trace" in the emulator)

UPDATE

i changed appsettings to

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

and botservice to

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

In messenger, it is now replying but detecting everything i type as "cancel" intent. I added a code to see intent and you can see the difference between emulator and messenger.

I typed the same thing on emulator but luis,qna and dispatch is working fine.

来源:https://stackoverflow.com/questions/57600902/botframework-publish-to-azure-error-no-such-host-is-known

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!