jonatec
asked on
WCF newbie, method not exposed.
Hi
I'm learning WCF. I have a class HelloWorldService.cs hosted by ASP.NET Dev Server and have created an interface for this. I consume the Service using a console app. Works fine with the first "Hello World" method GetMessage, however when I add a second method AddTwoNames, it just refuses to appear anywhere. Tried updating the Service Reference, removing it, even rebooting. Where am I going wrong please?
Thanks.
I'm learning WCF. I have a class HelloWorldService.cs hosted by ASP.NET Dev Server and have created an interface for this. I consume the Service using a console app. Works fine with the first "Hello World" method GetMessage, however when I add a second method AddTwoNames, it just refuses to appear anywhere. Tried updating the Service Reference, removing it, even rebooting. Where am I going wrong please?
Thanks.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MyWCFServices
{
public class HelloWorldService: IHelloWorldService
{
public string GetMessage(string name)
{
return "Hello from " + name + "!";
}
public string AddTwoNames(string firstname, string lastname)
{
string fullname = string.Empty;
fullname = firstname + " " + lastname;
fullname.ToUpper();
return fullname;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
namespace MyWCFServices
{
[ServiceContract]
public interface IHelloWorldService
{
[OperationContract]
string GetMessage(string name);
string AddTwoNames(string firstname, string lastname);
}
}
just clean the solution from gui menu, or delete all files from the bin directory. and then update the reference.
Also fullname.ToUpper() won't work.
You need to put fullName = fullname.ToUpper()
You need to put fullName = fullname.ToUpper()
ASKER
Tried solution Clean and re-build, second method still doesn't appear the object browser for the Service Reference, (please see screen shot).
dump-1.jpg
dump-1.jpg
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.