c# - How to share same address for multiple endpoints -
i have created rest service wcf , have different contracts(contract1, contract2, etc..). configuration in web.config
<endpoint address="users" binding="webhttpbinding" behaviorconfiguration="web" contract="filminfoapi.service.iuserservice"/> <endpoint address="actors" binding="webhttpbinding" behaviorconfiguration="web" contract="filminfoapi.service.iactorservice"/> <endpoint address="films" binding="webhttpbinding" behaviorconfiguration="web" contract="filminfoapi.service.ifilmservice"/>
it's example of contract.
[operationcontract] [webget(uritemplate = "?offset={offset}&count={count}", responseformat = webmessageformat.json)] films getfilms(string offset, string count);
so question how can use same address endpoints (localhost/rest). because need contract uritemplate more flexible, example if need return list of films category (uri example: localhost/rest/category/2). uri , current configuration (address property in web.config) must put method category contract. in mine opinion methid must in films contract. has solution or it's normal?
if want expose multiple contracts single endpoint, have have 1 of contracts inherit other one. have endpoint expose derived contract. following:
[servicecontract] ifilmservice : iactorservice
then have 1 endpoint:
<endpoint address="rest" binding="webhttpbinding" behaviorconfiguration="web" contract="filminfoapi.service.ifilmservice"/>
Comments
Post a Comment