【发布时间】:2020-07-02 17:13:54
【问题描述】:
我正在使用 Python 中的 Azure Bot Framework SDK 构建一个机器人。 该机器人需要能够查询同样托管在 Azure 上的 SQL DB。
但是,当我尝试时
async def on_message_activity(self, turn_context: TurnContext):
cnxn = pyodbc.connect(<connectionstring>)
self.cursor = cnxn.cursor()
self.cursor.execute("SELECT * from tableA")
desc = self.cursor.description
并向机器人发送消息,我收到此错误,在机器人的“问题”选项卡中跟踪:
There was an error sending this message to your bot: HTTP status code ServiceUnavailable
我已启用 Azure 服务以访问 SQL 数据库并三重检查连接字符串。我错过了什么吗?这是从机器人查询 SQL 数据库的正确方法吗?
【问题讨论】: