C # web frontend creation - REST

I am going to run a project in C #. I never used C #, and I was hoping I could get some implementation recommendations before I made a stupid mistake and go the wrong way.

What I'm trying to achieve basically has a C # application on the server, which can be accessed through the web API. This application will accept some string variables and then return the string. The application will open and run some installed programs (and not C # programs).

I read about WCF, but I think it might be redundant at first glance, because the API that I hope to create will have only one or two query methods and will return a string.

What I'm really looking for is tips on what I should use, what to look for, and even links to good guides on creating web services using C # and how I can make a link between the web APIs for a C # application.

Thanks to everyone for any advice.

+7
source share
5 answers

Skip wcf and asmx. Instead, simply implement this material through shared handler files (.ashx).

You have full control over what comes and goes, without having to guess with all the garbage XML. We did this a while ago and did not look back.

In short, I would use WCF if my endpoints were something other than a web server. I would use asmx if I had to pass all the responses back as XML. And I was sure that only .net clients would access it.

Common handlers are similar to .aspx pages, but without all the overhead of the page life cycle. It gives you a context object that has access to all the variables of the http column and query string, and you decide what to fix.

They are easy to implement and have nothing of what was for this configuration setting again? questions.

Here are a couple of good walkthroughs:
http://swindelles.com/2008/07/11/creating-rest-web-services-in-c-sharp/
http://www.codeproject.com/KB/aspnet/RestServicesInASPNET2.aspx

+8
source

If you think WCF might be redundant, you can implement a simple ASP.NET MVC application that returns data as JSON or XML.

http://omaralzabir.com/create_rest_api_using_asp_net_mvc_that_speaks_both_json_and_plain_xml/

update: Another great option is ServiceStack . I used it, and it’s really nice to work with it.

+4
source

You can see the vanilla web service. I only looked briefly at him, but this one seems to be a worthy guide .

+1
source

You really need to look at WCF data services that are easy to implement.

http://msdn.microsoft.com/en-us/data/bb931106

I first met them when I implemented the Dino Esposito examples in March 2010. MSDN Magazine http://msdn.microsoft.com/en-us/magazine/ee336022.aspx

I recommend you read the Dino example first.

+1
source

For a simple web API, WCF is excessive, awkward, work oriented, and designed for SOAP services (this is web HTTP, but that was an afterthought).

The new guy on the ASP.NET MVC Web API block for lightweight web-based architectures. Get ready to see more and more of this young upstart.

+1
source

All Articles