How to host a RESTful C# webservice and test it.

Posted by Debby on Stack Overflow See other posts from Stack Overflow or by Debby
Published on 2010-06-09T23:21:36Z Indexed on 2010/06/09 23:32 UTC
Read the original article Hit count: 163

Filed under:
|

Hi,

I need to create a RESTful webservice in C#. This is what I have right now:

namespace WebService
{
   [ServiceContract]
   public interface IService
   {
     [OperationContract(Name="Add")]
     [WebGet(UriTemplate = "/")]
      int Add();  
   }

   public class Service:IService
   {
        public int Add()
        {
            // do some calculations and return result
            return res; 
        }
   }
}

Now, my question is How do i host this service at a location say (http://localhost/TestService) and how can i test the service in console application client?

© Stack Overflow or respective owner

Related posts about c#

Related posts about webservice