locked
Calling WCF service from a GAC'd assembly RRS feed

  • Question

  • User2043281626 posted
    Hello, Is there a way to call WCF service from a GAC'd assemly? The reason I am asking is because I've been told that you will run into issues if you try to rely on service reference. According to what I've heard it just won't work. Is this true? Is there way to call the WCF service without using a service reference? EDIT: If I was given the https://<dns name here>:<port>/<wcf service name here>.svc?singlewsdl, how could I make use of it versus adding a direct service reference?
    Friday, August 30, 2013 12:23 PM

All replies

  • User260886948 posted

    Hi,

    Using Add Service Reference is the easiest way to call a service when you are working with Visual Studio. If you still want to generate a proxy you can use the command-line tool svcutil.
    Otherwise you will have to work directly with the channel. 

    The following is an example about using channel without using the add service reference, please try to refer to: 

    BasicHttpBinding basicHttpBinding = new BasicHttpBinding();
    EndpointAddress endpointAddress = new EndpointAddress("http://localhost:1031/Service/Myservice.svc&quot;);
    IPersonService personService = new ChannelFactory<IPersonService>(basicHttpBinding, endpointAddress).CreateChannel();

    If you know the wsdl file, then please try to refer to the following:

    #How to create service proxy from wsdl file:
    http://stackoverflow.com/questions/4304281/create-web-service-proxy-in-visual-studio-from-a-wsdl-file .

    Best Regards.

    Monday, September 2, 2013 6:30 AM
  • User2043281626 posted

    Hi Amy,

     

    I will be given the wsdl at runtime. I have a public property that will be set by another application. The 2nd solution you presented seems a bit vague on how it could work for me. Do you know of a better example?

    Tuesday, September 3, 2013 7:24 AM