views:

133

answers:

1

I'm creating a simple WCF service (MailService), and have added a service reference to a client project. The object browser in the client project is successfully showing the MailService metadata, including an object called MailServiceClient that has 4 overloads for its constructor.

I want to use the single string parameter constructor, to nominate the endpoint name, for this client object:

MailServiceClient client = 
    new MailServiceClient("BasicHttpBinding_IMailService");

Problem is: VS2008 only sees the parameterless constructor, and that's stopping me going any further. It also (therefore?) can't see my only method, SendEmails(), in that client object as well.

Without showing every single line of code for the service, can anyone recognise what's I'm doing wrong here?

+1  A: 

That's unusual. I've seen it not have the parameterless constructor when there are multiple endpoints but I've never seen it only have the parameterless constructor. It sounds like maybe you have a partial class somewhere in a different namespace. Or maybe the Reference.cs generation failed for some reason. Right click on MailServiceClient and "Go To Definition". You should be able to tell right away if you're constructing the wrong class or there's a partial class disconnect.

Josh Einstein
Got it, thanks - see comment above. 'Go To Definition' immediately revealed the duplication of the namespace, which I hadn't even considered.
Rafe Lavelle