2017-07-07 76 views
1

我目前正在爲Unity應用程序鏈接到門戶Azure中我的機器人消息端點。要做到這一點,我使用的是UnityWebRequest.GET電話與在Unity DOC(https://docs.unity3d.com/Manual/UnityWebRequest-RetrievingTextBinaryData.html)解釋。UnityWebRequest和天青和博特問題

事實是,我總是遇到同樣的問題,當我啓動應用程序:The HTTP 'GET' method is not supported by the 'GenericJsonWebHookReceiver' WebHook receiver

我有沒有想法如何或在哪裏做我必須做,以解決這一變化。有沒有人面臨同樣的問題?

這裏是我的代碼

IEnumerator GetText() 
{ 
    UnityWebRequest www = UnityWebRequest.Get("<messaging endpoint of the bot>"); 
    yield return www.Send(); 

    if (www.isError) 
    { 
     Debug.Log(www.error); 
    } 
    else 
    { 
     // Show results as text 
     Debug.Log(www.downloadHandler.text); 

     // Or retrieve results as binary data 
     byte[] results = www.downloadHandler.data; 
    } 
} 

回答

1

你看到沒有什麼與團結的錯誤,但https://[YourBotId].azurewebsites.net/api/messages不是通過調用獲取,它是一個方法。如果您瀏覽到瀏覽器中的/ api/messages路徑,則會看到相同的錯誤消息。

enter image description here

你試過發佈一個活動的消息端點?

我還沒有嘗試過這一點,但也許它可以幫助你:https://github.com/tompaana/bot-direct-line-for-unity

+0

謝謝大家的幫助,這些細節是非常模糊了我。不幸的是,我在嘗試實現GitHub鏈接到我的項目時遇到了問題。 我發現了另一種方法來執行我想要的技能,但我不知道如何從在線Azure控制檯添加NuGet包:有沒有辦法做到這一點? –

+1

如果您的機器人是使用Azure Bot服務創建的,則可以在kudi中編輯project.json以添加nuget包。 https:// [YourSiteName] .scm.azurewebsites.net/DebugConsole /?shell = powershell然後導航到site/wwwroot/messages /然後編輯project.json並添加nuget包。 –

+1

它工作正常,謝謝! –