Botframework publish to azure error. “No such host

2019-08-27 02:24发布

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 enter image description here 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 enter image description here

LUIS keys and endpoint enter image description here

wwwroot enter image description here

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

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.

enter image description here

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

![enter image description here

0条回答
登录 后发表回答