orchardcms - How to consume WCF Service in Orchard -


i trying consume service in module in module web config added service config following.

<system.servicemodel> <bindings>   <basichttpbinding>     <binding name="wseventsoap" />     <binding name="basichttpbinding_itwitterservice" />     <binding name="basichttpbinding_iloyalty">       <security mode="transport" />     </binding>   </basichttpbinding> </bindings> <client>     <endpoint name="basichttpbinding_itwitterservice"         address="wwww.mysite.com/mediaservices/twitterservice.svc"            binding="basichttpbinding"          bindingconfiguration="basichttpbinding_itwitterservice"           contract="twitterservice.itwitterservice" /> </client> </system.servicemodel> 

within modules web.config. noticing

  1. i can't seem access web config settings in module
  2. i keep getting following error.

could not find default endpoint element references contract 'twitterservice.itwitterservice' in servicemodel client configuration section. might because no configuration file found application, or because no endpoint element matching contract found in client element.

please help.

on site i'm working on, betrand suggests, we've avoided modifying global web.config ensure module portable between projects.

instead we've created binding , endpoint in code, rather them getting pulled config. we've added our own setting orchard site settings let user specify endpoint address via admin dashboard, part need configurable.

to this, in module add service reference normal, if adds sections module web.config remove them won't using them.

then in code like

binding binding = new basichttpbinding(); endpointaddress address = new endpointaddress("http://localhost:8050/myservice/");  using (var client = new myserviceclient(binding, endpointaddress)) {     client.mymethod(); } 

there's plenty examples of on stackoverflow , elsewhere (e.g. wcf: how can programatically recreate these app.config values?)


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -