Link to home
Start Free TrialLog in
Avatar of jonatec
jonatecFlag for United Kingdom of Great Britain and Northern Ireland

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.
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);
	}
}

Open in new window

Avatar of PlatoConsultant
PlatoConsultant
Flag of United States of America image

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()


Avatar of jonatec

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
ASKER CERTIFIED SOLUTION
Avatar of luisx25
luisx25
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial