none
I am getting error "End Point Not Found" using webHttpBinding RSS RRS feed

  • Question

  • I am doing WCF RESTFUL application where at the time of POST method(where I am saving data to database so, giving parameters within the method) and using URI template .. but when i am accessing the method using URI template I am getting error "End Point Not Found" .

    Here below is my code:

    within iservice.cs:

    [OperationContract]
    [WebInvoke(Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "AddBook")]
    Book AddBook(Book book);

    Within service.cs:

    public Book AddBook(Book book)
    {
    using (MVCEntities entities = new MVCEntities())
    {
    Book book1 = new Book { BookName = book.BookName };
    entities.Books.AddObject(book1);
    entities.SaveChanges();
    return book;
    }
    }

    Monday, May 11, 2015 9:19 AM

Answers

  • Hi Lipsa Nayak,

    >>I am doing WCF RESTFUL application where at the time of POST method(where I am saving data to database so, giving parameters within the method) and using URI template

    Based on your above message, it seems that you are using the POST method, but based on your code [WebInvoke(Method = "GET"...., if you are using the GET method, so could you please tell me which method you want to do use and how do you access the method using the URI template by code or by browser?Since you need to put the Book parameter to the AddBook method, I will recommend you use the httpwebrequest/httpclient/jquery to help you get the correct result.

    Besides, in order to use the WCF Rest GET/POST method, please make sure that you have added the following in your config file:

    <endpoint address="" behaviorConfiguration="webBehavior" binding="webHttpBinding" contract="***" /> ....... <behaviors> <endpointBehaviors> <behavior name="webBehavior"> <webHttp /> </behavior>
    </endpointBehaviors>
    </behaviors>

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.





    Tuesday, May 12, 2015 6:30 AM
    Moderator