Accessing a COM EXE Server from an ATL Web Server


Gabby Shainer


I've written an ATL web server that implements a HelloDCOM method which then
calls a DCOM EXE server only to return the bstrInput prefixed by a "Hello "
When calling the DCOM interface, I get an E_ACCESSDENIED (0x80070005) error
code in return. What am I doing wrong?

my WebService method code:

HRESULT HelloDCOM(/*[in]*/ BSTR bstrInput, /*[out, retval]*/ BSTR
*bstrOutput) {
ITestServer* connection;

// create the COM object
hr = CoCreateInstance(CLSID_TestServer, NULL, CLSCTX_ALL,
IID_ITestServer, (void**) &connection);
if(!SUCCEEDED(hr)) {
CString err;
err.Format("Error creating DCOM instance : %X", hr);
*bstrOutput = err.AllocSysString();
return S_FALSE;
return connection->HelloWorld(bstrInput, bstrOutput);

In dcomcnfg I've given full access allowed to the Everyone, ASPNET, and
IUSR_GABBY (which is the account under which the IIS is configured to run
anonymous calls) users, for launching and accessing the DCOM server.

Your help will be much appreciated,

Gabby Shainer
The Relegence Corporation.

Girish Bharadwaj

Where do you fail? At the CoCreate or at the point of the method call?
Because, if you fail at CoCreate, you might be having problems with
Launching the DCOM server.. That might mean that the launching user is not
someone with enough credential.
If its failing at the point of call, that might mean that the person making
the request might be different than you thought it would be . :) Try logging
the USER (GetUserName() or some such API) currently doing the call. Also,
you can turn on security auditing and watch the event log for any failure

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question