microsoft / microsoft/Agent365-Samples
Dotnet sample - bad gateway / 404s on smba.trafficmanager.net
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 108
- Forks
- 59
- PR merge metrics
- No merged PRs in 30d
Description
Description
Hi,
I'm getting errors running the dotnet sample when I use a devtunnel to expose my /messages endpoint to A365 and create an instance of my agent using Teams.
I can see lifecycle notification events pushing through the system, however:
- My agent is not called when I try converse with it in teams.
- If I try to send an activity on a lifecycle event I receive a 502 Bad Gateway from smba.trafficmanager.net
- I do receive a notification from Word telling me my user is trying to contact my agent
- If I respond to this I receive a 404 from smba.trafficmanager.net
Everything works in the playground. No issues at-all.
Any tips on where to go next?
Thanks,
Graeme
Expected behavior
No response
SDK Version
Latest
Language/Runtime
.NET 8 and 10
OS
MAC OS 21
How to Reproduce
- Use Microsoft Agent Framework dotnet sample
- Use a365 to config, setup and deploy the agent
- Run agent with a devtunnel messaging endpoint
Output
POST https://smba.trafficmanager.net/amer/7cd964e4-a3be-4627-a8df-2b8371609081/v3/conversations/<large-id> HTTP/1.1
HTTP/1.1 502 Bad Gateway
Content-Length: 0
Server: Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0
Date: Sat, 21 Feb 2026 07:07:58 GMT
Microsoft.Agents.Core.Errors.ErrorResponseException: ReplyToActivity operation returned an invalid status code '(502) BadGateway'
at Microsoft.Agents.Connector.RestClients.ConversationsRestClient.ReplyToActivityAsync(String conversationId, String activityId, IActivity body, CancellationToken cancellationToken)
at Microsoft.Agents.Connector.RestClients.ConversationsRestClient.ReplyToActivityAsync(IActivity activity, CancellationToken cancellationToken)
at Microsoft.Agents.Builder.ChannelServiceAdapterBase.SendActivitiesAsync(ITurnContext turnContext, IActivity[] activities, CancellationToken cancellationToken)
at Microsoft.Agents.Builder.TurnContext.<>c__DisplayClass34_0.<<SendActivitiesAsync>g__SendActivitiesThroughAdapter|1>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.Agents.Builder.TranscriptLoggerMiddleware.<>c__DisplayClass2_0.<<OnTurnAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.Agents.Builder.TurnContext.SendActivityAsync(IActivity activity, CancellationToken cancellationToken)
at Microsoft.Agents.Builder.TurnContext.SendActivityAsync(String textReplyToSend, String speak, String inputHint, CancellationToken cancellationToken)
at Agent365AgentFrameworkSampleAgent.Agent.MyAgent.OnLifecycleEvent(ITurnContext turnContext, ITurnState turnState, AgentNotificationActivity agentNotificationActivity, CancellationToken cancellationToken) in /Users/g/code/github/microsoft/Agent365-Samples/dotnet/agent-framework/sample-agent/Agent/MyAgent.cs:line 117
Screenshots
No response
Code of Conduct
- I agree to follow the Microsoft Open Source Code of Conduct.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with dotnet/agent-framework/sample-agent/Agent/MyAgent.cs at line 117, where the lifecycle event sends the reply, and compare the deployed Teams/devtunnel path with the working playground. Check the messaging endpoint and A365 configuration while reproducing the 502 and 404 responses. Done means Teams can invoke the agent and lifecycle replies complete without those gateway errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100