This question is locked. New answers and comments are not allowed.
Hi All,
I am new to Telerik and I am currently trying to implement a Restful Web Service App that will accept Http injects and either display or process data. I have performed the following steps and I am having trouble:
From here I then wanted to view the data in my database in xml or json. I setup some routing so that i could more easily access the service, as shown below:
Global asax.cs
Once I then run the application and went to the routing address which should have pointed me to the Service I got an error saying is not compatible with asp.net, so I added the below code to the Users.svc.cs to fix it:
Now When I run the application and go to say the following address "http://localhost:14644/Users/", I get the results as shown below where as I would like it to show me the data in an XML/Json format.
Can anyone please help with this? If you need more info please let me know.
Thanks
I am new to Telerik and I am currently trying to implement a Restful Web Service App that will accept Http injects and either display or process data. I have performed the following steps and I am having trouble:
- I have created a new Class Library project in visual studio.
- I then added a "Telerik OpenAccess Domain Model" to that project and successfully linked it to my database.
- I then Added a web project to my solution.
- I then used the Data Services Wizard (DWS) to create a REST Collections for the app, this was successful.
- From this a number of files were added to the project icluding ICollectionService.cs, DataManager.cs, Users.svc etc.
From here I then wanted to view the data in my database in xml or json. I setup some routing so that i could more easily access the service, as shown below:
Global asax.cs
using System;using System.ServiceModel.Activation;using System.Web;using System.Web.Routing;namespace WcfRestService1{ public class Global : HttpApplication { void Application_Start(object sender, EventArgs e) { RegisterRoutes(); } private void RegisterRoutes() { // Edit the base address of Users by replacing the "Users" string below RouteTable.Routes.Add(new ServiceRoute("Users", new WebServiceHostFactory(), typeof(Users))); } }}Once I then run the application and went to the routing address which should have pointed me to the Service I got an error saying is not compatible with asp.net, so I added the below code to the Users.svc.cs to fix it:
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]Now When I run the application and go to say the following address "http://localhost:14644/Users/", I get the results as shown below where as I would like it to show me the data in an XML/Json format.
Can anyone please help with this? If you need more info please let me know.
Thanks