0

I've been following Microsoft's Teams C# tutorials found here, and have been successful for the most part. However, I cannot seem to get my app to work when I host the messaging endpoint myself rather than via their Azure service, which is not an option for me ultimately as the pricing is outrageous for what we need it to do.

I'm hosting the endpoint myself by publishing the sample project and ensuring it's externally available via HTTPS. I can access a custom tab within Teams, so I know that it's online, it's just the messaging endpoint that seems to fail with an "unable to reach app" error when I try and use the messaging extension via a chat window.

When debugging using dev tools, I get 502 error: Bot returned unsuccessful status code Forbidden, error code 1008. Every potential solution I've seen for similar issues hasn't worked for me thus far, though I still feel like it's something incredibly obvious. Are there special steps that need taking when hosting the endpoint yourself? The docs do a very lousy job of explaining the process, probably because Microsoft want you to pay to host the app on Azure.

Hilton Giesenow
  • 9,809
  • 2
  • 10
  • 24
AlternateView
  • 83
  • 1
  • 7
  • Are you facing the issue only with Message Extension? Does your bot work fine? Could you please share a screenshot of the message endpoint you have set for your bot? Which tool are you using for local debugging? Could you please try using [ngrok](https://ngrok.com/download) and follow the document [here](https://learn.microsoft.com/en-us/microsoftteams/platform/tutorials/get-started-dotnet-app-studio#tunnel-using-ngrok)? – Gousia Begum Feb 05 '20 at 05:37
  • Hi @Gousia-MSFT; I've not written any functionality into the bot since I don't need to use it, though when I was following the tutorial against an Azure hosted endpoint the bot did repeat my own messages back to me. My endpoint is hosted at https://teams.planetestream.org/api/messages which is just where I've published the project. https://teams.planetestream.org/hello works in Teams as a custom tab. For debugging I was simply using the developer tools window in Teams. When I tunnel using ngrok it works fine! So it has to be something I'm doing regarding my own hosted endpoint, surely. – AlternateView Feb 05 '20 at 10:29
  • So the issue with Message Extension is resolved when you used ngrok? – Gousia Begum Feb 05 '20 at 10:56
  • It seems so, yes - the problem has only ever been when trying to host the endpoint myself at the address above, even though no code has changed and the "hello" tab works fine. – AlternateView Feb 05 '20 at 11:17

3 Answers3

0

This is usually caused by the app id / app key not being registered or used correctly in your app, so it's not authenticating to the bot framework service properly. Where/how you do that depends a bit on what sample code / project template you started with, but it's usually somewhere in a .config file (or previously in a .bot file).

The information that you need will be in:

  1. App Id: The Bot Settings page in Azure
  2. App Key: from the Bot settings page, where you got the AppId above, it links to the App registration itself - within there you'll find the section on keys, and you can create a new key (if you've lost the original one)
Hilton Giesenow
  • 9,809
  • 2
  • 10
  • 24
  • The app ID / password for the bot is present in the web.config file - that does seem to be the #1 answer to a lot of related issues but not here. I can use the same bot successfully when the endpoint is set to a paid Azure subscription hosted site, but not my own. – AlternateView Feb 04 '20 at 17:02
0

I know it's generally an error when AppID validation fails. The bot app requests Azure AD to verify the identity.Could your web server access to Azure AD? If you deny to access to outbound with firewall, you should allow Azure IP range.

0

Turns out it was purely a network issue, that as of yet we still haven't actually figured out. But we tried hosting the app elsewhere and it was fine. That's my recommendation if anyone else has the same problem!

AlternateView
  • 83
  • 1
  • 7