I created a WCF service that has a basic method to add two numbers as follows:
[ServiceContract]
public interface IColorService
{
[OperationContract]
[WebGet(
RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json,
UriTemplate = "/AddNumber?number1={number1}&number2={number2}")]
int AddNumber(string number1, string number2);
}
public class ColorService : IColorService
{
public int AddNumber(string number1, string number2)
{
int num1 = Convert.ToInt32(number1);
int num2 = Convert.ToInt32(number2);
return num1 + num2;
}
I host the service on IIS 7.5. I check that it is running and getting back the correct result from the IE, as I typed "http://localhost/ColorsService/ColorService.svc/AddNumber?nubmer1=100&number2=200" and I got the result.
I created a Console application to test the WCF service and put the correct configuration in the app.config & also I added the service reference.
Here is the code I have to call the service
Service.ColorServiceClient client = new Service.ColorServiceClient();
double v = client.AddNumber("12", "15");
Console.WriteLine();
When I run the application I got this error : (405) Method Not Allowed !!
Can anyone help