简体   繁体   中英

Azure Bot Channel Registration for IIS hosted Microsoft Bot Framework sdk chat bot not working

I have created a chat bot using the Microsoft Bot Framework sdk that is working when tested on localhost with the Bot Framework Emulator along with the Microsoft App Id and Secret. I then deployed the bot on a publicly accessible IIS web server with the proper SSL certificate and when navigating to its link the proper "Your bot is ready." page appears showing that it is up and running.

I then created a Bot Channels Registration on Azure with the messaging endpoint to my bot hosted on my IIS web server. However, when I try the "Test in Web Chat" the bot shows nothing and presents no error in the user interface. However looking at the browser's dev tools console, there are a couple of errors indicating that my bots URL is being blocked from the azure portal by CORS policy as shown below. Has anyone encountered this scenario and/or have possible solutions to this? Thank you!

Access to XMLHttpRequest at ' https://MyBotUrl/api/messages/ ' from origin ' https://portal.azure.com ' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. :1 Access to XMLHttpRequest at ' https://MyBotUrl/api/messages/ ' from origin ' https://portal.azure.com ' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Have you configured CORS within IIS? If not, you'll need to. Allow the origin https://portal.azure.com . Is this a .NET Framework or .NET Core bot (or other)?

Unsure if it's needed, but there is an IIS CORS module .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM