none
How to create 2 proxies for 2 different clients RRS feed

  • Question

  • Hi,

       I have created  WCF service with 2 different contracts(Iservice1 & Iservice2) to consume these contracts i exposed  2 end points in config file with different address.

      want to create  2 different proxies for 2 different clients how will i do this?

    

    Public Class Service :Iservice1,Iservice2

    {

    }

    <endpoint name="firstbinding"address="/MyFirstBindingAddress" binding="httpbinding" contract="wcfService.Iservice1">

    <endpoint name="secondbinding"address="/MySecondBindingAddress" binding="httpbinding" contract="wcfService.Iservice2">

    <host>

    <baseaddress>

    <add baseaddress="http://servername/Service.svc" />

    </baseaddress>


    Girish




    Tuesday, March 22, 2016 4:51 PM

Answers

  • Hi girishrastogi,

    First please try to add the Services Reference by using the BaseAddress(http://servername/Service.svc ), after that we can access the WCF Service with two different Clients by using the following code:

    service1Client client1 = new service1Client("firstbinding");
    service2Client client2 = new service2Client("secondbinding");

    For more information, please try to refer to the following article:
    #Multiple Service Contracts in WCF Service:
    http://www.c-sharpcorner.com/uploadfile/dhananjaycoder/multiple-service-contracts-in-wcf-service/ .

    Best Regards,
    Amy Peng

    This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, March 23, 2016 1:51 AM
    Moderator
  • Hello,

    >>can i create 2 different proxies with two different end points so one client will not able to see others client service contract info?

    Using the following code will create two clients with two different endpoints:

    service1Client client1 = new service1Client("firstbinding");
    service2Client client2 = new service2Client("secondbinding");

    If you do not want one client see other client's service contract information, I will recommend you use some authentication for every service.

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. &lt;br/&gt; Click &lt;a href=&quot;http://support.microsoft.com/common/survey.aspx?showpage=1&amp;scid=sw%3Ben%3B3559&amp;theme=tech&quot;&gt; HERE&lt;/a&gt; to participate the survey.

    Friday, March 25, 2016 9:13 AM
    Moderator

All replies

  • Hi girishrastogi,

    First please try to add the Services Reference by using the BaseAddress(http://servername/Service.svc ), after that we can access the WCF Service with two different Clients by using the following code:

    service1Client client1 = new service1Client("firstbinding");
    service2Client client2 = new service2Client("secondbinding");

    For more information, please try to refer to the following article:
    #Multiple Service Contracts in WCF Service:
    http://www.c-sharpcorner.com/uploadfile/dhananjaycoder/multiple-service-contracts-in-wcf-service/ .

    Best Regards,
    Amy Peng

    This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, March 23, 2016 1:51 AM
    Moderator
  • Hi,

      Thanks, can i create 2 different proxies with two different end points so one client will not able to see others client service contract info?


    Girish

    Friday, March 25, 2016 4:12 AM
  • Hello,

    >>can i create 2 different proxies with two different end points so one client will not able to see others client service contract info?

    Using the following code will create two clients with two different endpoints:

    service1Client client1 = new service1Client("firstbinding");
    service2Client client2 = new service2Client("secondbinding");

    If you do not want one client see other client's service contract information, I will recommend you use some authentication for every service.

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. &lt;br/&gt; Click &lt;a href=&quot;http://support.microsoft.com/common/survey.aspx?showpage=1&amp;scid=sw%3Ben%3B3559&amp;theme=tech&quot;&gt; HERE&lt;/a&gt; to participate the survey.

    Friday, March 25, 2016 9:13 AM
    Moderator