Azure Bot Service
- Part 9 (Debugging your bot)為了開發邏輯更為複雜的 bot,利用本機開發是必然的,只是因為 Azure Bot Services
有包裝過所以開發上的設定有些小細節需要特別注意,克服這些問題就可以進入快速開發以及除錯了
以
C#
為例,以下軟體皆會使用到,其中 Visual Studio 2017 RC 可以使用Visual Studio 2015
代替
Microsoft Bot Framework Emulator
bot endpoint url
Azure bot service 下載回來的專案中所提供,預設為
http://localhost:3978/api/messages
Microsoft App ID
bot framework 的 app id
Microsoft App Password
bot framework 的 password
使用 command prompt
csproj
至 project.json
所在位置 dotnet restore
-->取回相依參考debughost.cmd
時,無相關設定的提示訊息----------------------------------------------------------------------
To fetch your bot service settings run the following command:
func azure functionapp fetch-app-settings [YOUR_BOT_SERVICE_NAME]
----------------------------------------------------------------------
Function completed (Failure, Id=7*******************************6d)
ScriptHost error has occurred
xception while executing function: Functions.messages. Microsoft.Bot.Connector: Authorization for Microsoft App ID failed with status code Unauthorized.
使用 Visual Studio 2017 RC
2-1. 下載csproj
至 project.json
所在位置
2-2. Restore Nuget Packages
2-3. 取回 Azure Function 設定
func azure functionapp fetch-app-settings {YOUR_BOT_SERVICE_NAME}
執行
debughost.cmd
時,無相關設定的提示訊息
---------------------------------------------------------------------
o fetch your bot service settings run the following command:
func azure functionapp fetch-app-settings [YOUR_BOT_SERVICE_NAME]
---------------------------------------------------------------------
``
Function completed (Failure, Id=7*******************************6d)
A ScriptHost error has occurred
Exception while executing function: Functions.messages. Microsoft.Bot.Connector: Authorization for Microsoft App ID failed with status code Unauthorized.


Microsoft Bot Framework Emulator
Log
區可以檢視回應,點選 log 可以在上方的 Details
區看到詳細內容command prompt
確認有收到以及正常執行
Visual Studio 2017 RC
Task Runner Explorer
執行服務
確認有收到以及正常執行
2-2. F5 直接逐步偵錯