Shadyzar
Shadyzar

Reputation: 35

C#, WCF, Hide web service through dll

In my dll I have a server reference to a web service. This WCF web service becomes visible to my client application that uses the dll. Is there a way to prevent this?

Thanks.

Upvotes: 0

Views: 956

Answers (2)

tom redfern
tom redfern

Reputation: 31760

If the reference is built into the URL then you will have to handle the fact it will be visible. The alternative is to not use service references. You can still call the service without a service reference by using the WCF channel stack in code.

To do this your client only needs a references to the service interface and the types which are exposed on the service's operations. Then you can use ChannelFactory<ServiceInterface>("NameOfServiceInConfigFile").CreateChannel() to return your proxy.

Upvotes: 0

Jakob Christensen
Jakob Christensen

Reputation: 14956

When adding the service reference, click the "Advanced" button. This will give you the option to generate all client service classes as internal instead of public.

enter image description here

Upvotes: 3

Related Questions