Click here to Skip to main content
15,905,148 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

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[^]
 
Share this answer
 
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)



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