I have created a simple WCF by following several tutorials. I have modified my web.config file to add the endpoint (whatever that is). I added a ServiceReference to my solution… Now I just want to call the darn thing to see if it works…
I found this code when I viewed the service in the browser:
ServiceClient client = new ServiceClient();
// Use the 'client' variable to call operations on the service.
// Always close the client.
client.Close();
But when I plug it into my default.aspx on my website I get errors:
The type or namespacen anme ‘ServiceClient’ could not be found. All I want to do is call it to see how I reference the method (with parameters) and how it returns the data. I just need a jumping point to start working with WCF.
Please help.
Answered!
SnOrfus – His answer did the trick. As soon as I added the ServiceReference to the project then when I hovered over the client variable it prompted me to add ServiceReference name (which was ServiceReference1).
I was then able to call my method and display the results.
Thanks!
What is your service interface called and what namespace did you give it when you added it? For instance, if you defined it thusly:
if you imported it using the Add Service Reference dialog and gave it a namespace of JeffService… it would look like: