Skip to content

Dotnet sample - bad gateway / 404s on smba.trafficmanager.net #228

@graemefoster

Description

@graemefoster

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

  1. Use Microsoft Agent Framework dotnet sample
  2. Use a365 to config, setup and deploy the agent
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions