I have a fairly old custom TransportAgent project running on my in-house Exchange 2016. It's based off the samples for .NET-based SmtpReceiveAgentFactory samples, and has been running flawlessly for years. But at some point I assume a CU to Exchange 2016 (I'm running latest now) caused some behavior change. I'm hoping others with TransportAgents may have some thoughts.
In a nutshell, I register my agent, I see my SmtpReceiveAgentFactory-derived object gets created, and then CreateAgent is fired. Here's where things go awry. Previously, CreateAgent would be called once (passing in the SmtpServer), I'd use that to create my new SmtpReceiveAgent-derived object, and that Agent would get the events I register for. Eventually, the AgentFactory.Close would be fired, and I'd clean up.
Now, CreateAgent gets fired multiple times. Twice rapidly when the actual Transport Service starts, and then randomly about once per day another two will fire. But Close never fires unless I stop the Service (and then only once).
Because my Agent connects with a Windows Service, and there are no "cleanup" events firing, things go awry.
Again, this was working flawlessly for years, on multiple Exchange versions with minor updates with each major Exchange upgrade, but one of the fairly recent CUs changed something.
Anybody else dealing with this?