none
when i am executing this url in fiddler it's going to the method but in chrome or mozilla i am getting "Method not allowed". below is my code : RRS feed

  • Question

  • url is : http://localhost:64755/Service1.svc/web/AddBook/Physics

    within iservice.cs:

    [OperationContract]
    [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "AddBook/{book}")]
    void AddBook(string book);

    within service.cs

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

    }
    }

    Tuesday, May 12, 2015 9:36 AM

Answers