A random collection of epiphanies, thoughts and problem solutions pertaining to .NET and BizTalk.

Saturday, May 20, 2006

System.Web.Services.Protocols.SoapException: Server was unable to process request. --> Cannot create ActiveX component. EnvDTE

I got this exception thrown at me when I tried to do the following in the web service:

DTE ideObject = (DTE) Microsoft.VisualBasic.Interaction.CreateObject
(
"VisualStudio.DTE.7.1", ""
);

You may run into the similar problem if you wanted to access native Microsoft objects such as excel or word. There are two solutions:
1) Make sure your aspnet_wp work process runs under a priviledged account that has the sufficient permission to carry out this task. This is usually done through the impersonation in web.config file. You will find plenty of posts explaining how this is achieved.
2) Grant explicit Launch/Activation and Access permission to "Microsoft Visual Studio Solution Object" in DCOM Config.

The following are the steps for option 2):
a) Go to "Start | Settings | Control Panel | Administrative Tools | Components Services".
b) Drill thru "Components Services -> Computers -> My Computer -> DCOM Config"
c) Select "Microsoft Visual Studio Solution Object"
d) Right click and bring up the "Properties"
e) Click on the "Security" Tab
f) In the groupbox "Launch and Activation Permissions"; select "Customize" radio button and click on "Edit" button; check both "Local Launch" and "Local Activation" to grant these permissions to Machine\ASPNET account.
g) In the groupbox "Access Permissions"; repeat step (f) to grant the "Local Access" to Machine\ASPNET account.
h) Click "Apply" to apply the changes.

Here are some screen shots:


Microsoft Visual Studio Solution Object Properties

Launch and Activation Permissions

Access Permissions

Followers