0

I created application page in empty sharepoint page. Then i added service reference to my wcf service hosted outside sharepoint farm. It added reference successfully. But when i initialise

var mySer = new MyService();

i get error

Could not find default endpoint element that references contract 'MyService.IMyService' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element."

So then i added web reference instead of service reference. But when i access some of its methods i get error

SOAP header action was not found.

What is correct way to consume web service in sharepoint 2013 which are created outside farm.

When i consume same WCF service in normal asp.net application then it works. I add service reference in asp.net application and it works.

Update1 when i add webreference i dont see any app.config created. Is this might an issue?

0

Make sure your bindings are correct in the SharePoint 2013 web config file and iis configurations, if your using http or net pipe bindings change accordingly in iis.

  • its not generating web.config file when i add web rererence – Happy May 14 '15 at 10:03
  • You can find web.config under virtual directories folder – Shiva May 14 '15 at 10:36
  • So this web.config is not per project ? – Happy May 14 '15 at 10:39
  • For SharePoint projects it will be only one for web application – Shiva May 14 '15 at 10:40
  • When i create empty sharepoint project then web.config is not added in solution? I mean i cant see it.. is it correct? – Happy May 14 '15 at 10:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.