views:

413

answers:

2

I created a COM interop component using ClassLibrary which consumes WCF. Now when I call COM component's Method (which uses WCF) from my Classic ASP page, I'm getting the following error.

Error Type: System.ServiceModel (0x80131509) Could not find default endpoint element that references contract 'DLSWS.IDLSWS' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.

What I understand from the above error is : asp page is not able read the WCF configuration from the app.config file within the COM Component. How can i resolve this issue.Please help

Regards, Vinod

A: 

Does the COM component have an App.config file? If not, it's likely that the COM cannot access the configuration in web.config.

Either create an App.config file for the component or pass in the Endpoint instance from the web application.

Richard Szalay
Hai Richard. My COM Component has app.config which has all the WCF information.The problem here is when i call the COM component from classic ASP page it is not being able to load the WCF related endpoint info from the app.config file.So how can i achieve this ?
As darin mentioned, make sure that you have set the "Application Root" directory in the COM+ application properties. If you are using Windows 2000, darin outlines a workaround.
Richard Szalay
+1  A: 

You could either set your endpoint programatically when creating the client channel inside your COM object or use an app.config.

To set an app.config for COM+ application:

If you are using Windows 2000, and your COM+ app is a server one, your app.config should be called dllhost.exe.config and must be in the same directory as dllhost.exe (which is %SystemRoot%\System32).

If you are using Windows 2003, you can go to the Activation tab of the COM+app properties and set the Application Root Directory property to point to a location of your preference, and, in that directory, you must place a file called application.config (with your config settings) and another file caller application.manifest with the content shown bellow:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
</assembly>
Darin Dimitrov
Hai Darin, My COM Component has app.config which has all the WCF information.The problem here is when i call the COM component from classic ASP page it is not being able to load the WCF related endpoint info from the app.config file.So how can i achieve this ?
Where is your app.config stored? As I described in my post if you are on Windows 2000 the file has to be called dllhost.exe.config and located in %SystemRoot%\System32 and if you are on Windows 2003 the file needs to be called application.config along with application.manifest file.
Darin Dimitrov
@darin: I suspect the vinod hasn't twigged the "plus" bit of "COM+", there is no mention of COM+ in the question.
AnthonyWJones