[ServiceContract] [ServiceKnownType(typeof(test))] interface ItestbService { [OperationContract] IList RetrieveTestList(); } public class TestWebService : ItestbService { [WebInvoke(UriTemplate = "RetrieveTestList", Method = "GET", ResponseFormat = WebMessageFormat.Json,RequestFormat = WebMessageFormat.Json)] public IList RetrieveTestList() { return new test().ListOftests(); }then in separate project I hosted it using the following code using svc file using the following line
<%@ ServiceHost Language="C#" Debug="true" Service="test.WebService.TestWebService" CodeBehind="test.WebService.TestWebService.cs" %>and this is the web.config
name="test.WebService.TestWebService"> address="" binding="webHttpBinding" contract="test.WebService.ItestbService" behaviorConfiguration="web"> name="web"> /> maxItemsInObjectGraph="2147483647"/> maxItemsInObjectGraph="2147483647" /> httpGetEnabled="true" /> includeExceptionDetailInFaults="true" /> name="defaultRest"> maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="64" maxNameTableCharCount="2147483647" /> mode="None" /> multipleSiteBindingsEnabled="true" /> put when call in the browser the method it give bad request
Replies
Know the answer? Post it — somebody with the same question will find it here.