Needed help in wcf service consuming

7.2k views Asked by At

I have this WCF service hosted on IIS. When I try to consume it in my client project using below code I get following exception "An error occurred while sending the request"

LaunchService.LaunchServiceClient launchServiceClient =
            new LaunchService.LaunchServiceClient(
            new BasicHttpBinding(),
            new EndpointAddress("http:// Service base address"));

If I change BasicHttpBinding() to WebHttpBinding() in above code(as in my web.config file) I get this error

"System.TypeLoadException: 'Could not load type 'System.ServiceModel.WebHttpBinding' from assembly 'System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.'"

When using default constructor, I get this error

"System.PlatformNotSupportedException: 'Configuration files are not supported. "

LaunchService.LaunchServiceClient launchService = new LaunchService.LaunchServiceClient();

I tried changing setting in web config file, but any changes in it wont make the service work.

Any help?

Thanks in advance..

1

There are 1 answers

3
Abdullah Tahan On

I got this issue when i added a reference of .net project ('which has the service') in my core project

solution : remove .net project and add new core project

note : some implementation must be modified when initializing the service