Click here to Skip to main content
12,953,263 members (47,395 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
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 21: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
Top Experts
Last 24hrsThis month
OriginalGriff 6,429
CHill60 3,490
Maciej Los 3,103
Jochen Arndt 1,975
ppolymorphe 1,920


Advertise | Privacy | Mobile
Web01 | 2.8.170525.1 | Last Updated 14 Jan 2013
Copyright © CodeProject, 1999-2017
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