Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
4.00/5 (1 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.
HTML
<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

1 solution

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.
HTML
<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>
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900