Where are my WCF client constructors overloaded?

I am creating a simple WCF service (MailService) and have added a service link for a client project. In the object browser, the client project successfully displays MailService metadata, including the MailServiceClient object, which has 4 overloads for its constructor.

I want to use the single-row constructor to assign an endpoint name to this client object:

MailServiceClient client = 
    new MailServiceClient("BasicHttpBinding_IMailService");

The problem is that VS2008 only sees a constructor without parameters, and this stops me further. It also (therefore?) Cannot see my only method, SendEmails (), in this client object.

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

+3
source share
1 answer

It's unusual. I saw that it does not have a constructor without parameters when there are several endpoints, but I have never seen that it has only a constructor without parameters. It looks like you have a partial class somewhere in a different namespace. Or perhaps the generation of Reference.cs failed for some reason. Right-click MailServiceClient and select Go To Definition. You should be able to tell right away if you are building the wrong class or disable the partial class.

+1
source

Source: https://habr.com/ru/post/1735181/


All Articles