InfiniTec - Henning Krauses Blog

Don't adjust your mind - it's reality that is malfunctioning

How to use applications settings from an event sink

A while ago, I posted an article on how to create managed event sinks. This is a follow-up on that article covering application settings.

Normally, application files are named after the .EXE file which hosts a managed component: An .exe file called myapplication.exe has a configuration file of myapplication.exe.config which resides in the same directory as the myapplication.exe file.

There are two issues when dealing with Exchange event sinks: First, the working directory is %systemroot%\system32. And second, the executable host is svchost.exe. With .NET 1.1, the only option here was to create a svchost.exe.config in %systemroot%\system32. Bad days for those with more than one managed COM+ application on one server.

Since .NET 2.0, the world has become a better place. At least, in this scenario. You can now place your configuration data in a file named application.config and place that file into the folder where your COM+ application resides. You must then create an xml file in that directory with the name application.manifest and the following content:

    1 <?xmlversion="1.0"encoding="UTF-8"standalone="yes"?>

    2 <assemblyxmlns="urn:schemas-microsoft-com:asm.v1"manifestVersion="1.0" />

Now, you must reconfigure your COM+ application to set the working directory to the directory where your COM+ DLLs reside: Open Component Services, navigate to your applicatoin and open the properties.


Activation propertysheet in component services (click to enlarge)
In the text box Application Root Directory, specify the path your event sink.

That's all.


Technorati:

Posted by Henning Krause on Wednesday, January 31, 2007 12:00 AM, last modified on Wednesday, January 31, 2007 12:00 PM
Permalink | Post RSSRSS comment feed

Comments (1) -

On 6/12/2009 5:58:27 PM Ranjit Cherian United States wrote:

Ranjit Cherian

I am able to register event sink with out  config file.But I tried to register event sink after adding application.config file as mentioned above .Then I am getting below error.

Error Commiting Transaction : -2141913011 Event Registration failure: The specified event sink (ProgID: %1) is not allowed to run in-proc.

Please help me