Click here to Skip to main content
14,695,329 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ,Please help me for this problem,

i am trying to learn the wcf rest service.i have used the [webinvoke(method="POST" ....)] and also edit the web.config file for the restful service.but whenever i test my service its showing methods not allowed.why this happend?
Kornfeld Eliyahu Peter 3-Jun-14 10:25am
It's hard to say something specific without your code, so if you not interested in a global-scale lecturing please post it...
PramodParth 4-Jun-14 1:35am
first upon i would like to say thanks for your i mentioned my code below please help me to get a solution..

here is the servicecontract
public interface ITestservice

UriTemplate = "GetData/{value}",
string GetData(string value);


public class Testservice : ITestservice

public string GetData(string value)

SqlConnection mycon = new SqlConnection("Data Source=HORIZON2-PC\\HORIZON2013;Initial Catalog=SBL;Trusted_Connection=true;");
SqlCommand mycmd = new SqlCommand("insert into Books (BookName) values(@name)", mycon);
// mycmd.Parameters.AddWithValue("@id",SqlDbType.Int).Value= value;
mycmd.Parameters.AddWithValue("@name", SqlDbType.VarChar).Value = value;
int x = mycmd.ExecuteNonQuery();
if (x > 0)
return "success";
return "failed";



This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

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