none
MS Exchange 2013: Transport service stops after enabling my own transport agent RRS feed

  • Question

  • Hi,

    I am newbie to Exchange. I am learning how to create and use transport agent in Exchange2013. I have written very simple transport agent with the help of "RoutingAgent" and "RoutingAgentFactory" The Transport agent gets install properly. After the enabling it, MSExchangeTransport service startes and stops after few seconds. Following is code snippet.

    namespace myTestTransport
    {
        /// Agent factory for QHRoutingScanAgent
        /// Microsoft Exchange Transport service uses this factory to create object QHRoutingScanAgent object
        /// A separate object is created for each email
        public class MyRoutingScanAgentFactory : RoutingAgentFactory
        {
            //Exchange uses this method to create transport agent object for each email
            public override RoutingAgent CreateAgent(SmtpServer server)
            {
                AddressBook addressBook = (server != null) ? server.AddressBook : null;
                return new MyRoutingScanAgent(addressBook);
            }
    
            public MyRoutingScanAgentFactory()
                : base()
            {
            }
    
            ~MyRoutingScanAgentFactory()
            {
    
            }
        }
    
        public class MyRoutingScanAgent : RoutingAgent
        {
            private AddressBook addressBook;
    
    
            /// <summary>
            /// The constructor registers an end of data event handler
            /// </summary>
            public MyRoutingScanAgent(AddressBook addressBook)
            {
                this.addressBook = addressBook;
                this.OnCategorizedMessage += new CategorizedMessageEventHandler(OnCategorizedMessageHandler);
                this.OnSubmittedMessage += new SubmittedMessageEventHandler(OnSubmittedMessageHandler);
            }
    
            /// It is invoked by Exchange when a message has been submitted
            /// It is invoked before OnCategorizedMessageHandler event
            void OnSubmittedMessageHandler(SubmittedMessageEventSource source, QueuedMessageEventArgs e)
            {
                
            }
    
            /// It is invoked after OnSubmittedMessageHandler event
            /// It is called twice if email has both internal and external recipients
            void OnCategorizedMessageHandler(CategorizedMessageEventSource source, QueuedMessageEventArgs e)
            {
               
    
            }
        }
    }

    I am using Visual Studio 2008 with .net Framework 3.5.

    Mailbox and Client Access servers are on same machine. (Exchange 2013)

    I have tried above code with compiling with different .net versions (3.5, 4.0, 4.5), besides I hv Exchange Server 2010 SP1 Transport agent SDK installed. I have followed the instructions from here

    In the event viewer there is no error logs. Kindly let me know, if I m missing something.

    Thanks in advance for help.


    Monday, December 10, 2012 1:01 PM

Answers

  • You should be getting at least an error in the Application log from the Transport Service with the exception that is being caused ?

    A few basic things to check is one make sure the Network Service account has access to the directory where your class library is located. This is critical and wont be enabled by default.

    Make sure you have closed the powershell session you used to install the class library (this tends to lock the library).

    By default on Exchange 2013 a class library would need to be compiled against 4.0 if you want to support other frameworks you need to configure the supportedRuntime versions in the config file.

    Cheers
    Glen

    • Marked as answer by Jacks_Sparrow Tuesday, December 11, 2012 12:15 PM
    Tuesday, December 11, 2012 5:22 AM

All replies

  • You should be getting at least an error in the Application log from the Transport Service with the exception that is being caused ?

    A few basic things to check is one make sure the Network Service account has access to the directory where your class library is located. This is critical and wont be enabled by default.

    Make sure you have closed the powershell session you used to install the class library (this tends to lock the library).

    By default on Exchange 2013 a class library would need to be compiled against 4.0 if you want to support other frameworks you need to configure the supportedRuntime versions in the config file.

    Cheers
    Glen

    • Marked as answer by Jacks_Sparrow Tuesday, December 11, 2012 12:15 PM
    Tuesday, December 11, 2012 5:22 AM
  • Thanks a lot Glen,

    I forgot to give access to my transport agent assembly directory to Network Service Account.

    It is working fine ..

    Cheers !!

    Tuesday, December 11, 2012 12:16 PM