If you already have an MVC 4 application, it would be better to use the Web API (RESTful service). I assume that you have some knowledge in creating the REST API (understanding POST, PUT, UPDATE)
It is easy to configure and use. All you need to do is create a new controller, for example:
class MyApiController: ApiController { public Post(SomeClass item) { ....connect to db and do whatever you need with the data } }
You must also configure routing for Api.
And then in your winForms application, you can simply use the HttpClient class to make an api call.
HttpClient aClient = new HttpClient(); // Uri is where we are posting to: Uri theUri = new Uri("https://mysite.com/api/MyApi"); // use the Http client to POST some content ( 'theContent' not yet defined). aClient.PostAsync(theUri, new SomeClass());
Take a look at some implementation details right here: Getting Started with Api
Getting started with WCF is not as easy as using the web API.
Skirius
source share