Click here to Skip to main content
14,027,741 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
How can a website that is hosting a wcf service, consume that service itselft?

Here is the VS2013 solution:
http://www.datafilehost.com/d/c3bdffe8[^]
Please see readme.txt
Posted

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

I guess you can create the object of service contract class directly in your website and access the required operations from your website . For more details see related question in wcf interview questions and answers [^] or you can see direct question
how-to-consume-a-wcf-service-from-client-application-choose-most-relevant-step-by-step-procedure[^]
   
Comments
Member 10413919 22-Apr-14 8:45am
   
well, this works fine:
Service1 a = new Service1();
string s = a.GetUserInfo("");
I'm just not sure if this is the right way to do it. All the examples I saw are like this -
Add service reference, and then:
using (Service1Client client = new Service1Client())
{
string u = client.GetUserInfo("");
}
pallelokanathareddy 10-May-14 9:23am
   
using the using the block is correct approach since all the service class objects are internally using un-managed objects .

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


Advertise | Privacy | Cookies | Terms of Service
Web03 | 2.8.190419.4 | Last Updated 22 Apr 2014
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100