Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: WCF web.Config
I have a custom username-password WCF service that needs to be called by Windows client (Winforms application) as well as by Web client (html/aspx page). I have two endpoints declarations in web.config but, to make it work, I have to comment one of them and so, only the client type, associated with that un-commented endpoint, can access the service. If I un-comment that, and comment the other one, other client can access it. I can't keep both of them and so I can't access it from both types of clients.
<service behaviorConfiguration="Behavior1" name="BeST.Service.Service">
    <endpoint address="" binding="webHttpBinding" contract="BeST.Service.IService" behaviorConfiguration="EndpBehavior"></endpoint>
    <endpoint address="" binding="wsHttpBinding" bindingConfiguration="Binding1"
     contract="BeST.Service.IService" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost/" />
      </baseAddresses>
    </host>
  </service>
just as the code shows, I need to use both endpoints (above two endpoints) if I want to make this service work for both clients OR, if there's another way to have it done, please help!
Posted 13-Jan-13 22:56pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

change the address property of one of the endpoints and use that in your service URL, it should work; the problem occurring in your case is the similarity of "address" of two endpoints.
<service behaviorconfiguration="Behavior1" name="BeST.Service.Service">
  <endpoint>address="web" binding="webHttpBinding" contract="BeST.Service.IService" behaviorConfiguration="EndpBehavior"></endpoint>
  <endpoint address="" binding="wsHttpBinding" bindingconfiguration="Binding1">
    contract="BeST.Service.IService" />
  <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  <host>
    <baseaddresses>
      <add baseaddress="http://localhost/" />
    </baseaddresses>
  </host>
</endpoint></service>
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 350
1 Jochen Arndt 150
2 Richard MacCutchan 135
3 PIEBALDconsult 110
4 Sergey Alexandrovich Kryukov 104
0 OriginalGriff 6,055
1 DamithSL 4,621
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,500
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 14 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100