The server has not found anything matching the requested URI

Posted by Community Admin on 04-Aug-2018 09:42

The server has not found anything matching the requested URI (Uniform Resource Identifier). (XHR): POST - localhost:11321/.../GetNewsTitles

All Replies

Posted by Community Admin on 23-May-2017 00:00

I have tried to create a RESTful WCF service to retrieve titles of news items suing the tutorial at the mentioned link below but my console says "HTTP404: NOT FOUND - The server has not found anything matching the requested URI (Uniform Resource Identifier).
(XHR): POST - localhost:11321/.../GetNewsTitles"

 

Link:  docs.sitefinity.com/tutorial-create-a-restful-wcf-service-to-retrieve-titles-of-news-items

 

I used JavaScript widget to call the service with ajax call as mentioned in the tutorial.

What is that I'm missing?

 

Would appreciate your inputs.

 

Screenshot attached for the project folder structure in VS.

 

Thanks,

Santosh

Posted by Community Admin on 31-May-2017 00:00

No need to create any rest service to news items. Sitefinity provides inbuilt. Below lines of code should give you everything related to News items.

My script in Javascript widget inside a page :

$.ajax(
     type: "GET",
     url: "/sitefinity/services/content/newsitemservice.svc/",
     contentType: "application/json; charset=utf-8",
     dataType: "json",
     data: JSON.stringify( skip: 0, take: 10 ),
     success: function (result) console.log(result);
                                 for(var i=0; i<=result.TotalCount;i++)                                   
                                $("#Mydata").append(result.Items[i].Title);  /* #Mydata is the id of a div placed in my page in content block widget to append my results to show on my page */
                                ,
     error: function (error) alert(error);
 );

 

Also Sitefinity provides rest services for all the inbuilt content. You can find them in your project folder with path as  YourProject/Sitefinity/Services in visual studio.

Thanks,

Santosh

 

This thread is closed