1

I need to write a client-server application. First of all, I'm going to write an application server. Also my app server should connect to database(MS Sql Server) and give data from it to client app. So, as I know, I should use WCF. Is it a good idea? Maybe I need to take a look for something else?

Gleb
  • 1,412
  • 1
  • 23
  • 55

2 Answers2

2

Lets start with client-server architecture.
Assuming you have finalized that you need client and server, but have you decided carefully the architecture? I mean what type of server and what type of client you are going to create?

Let's see the options here:

Server
1. What type of hosting you are going to use?
2. What type and how much load your server needs to handle?

Client
1. Type of consumer of your service
2. Do client need to be deployed on local machine or it should be web based?

There are obviously more concerns than above. Initial design should be as flexible as possible.

So, now lets look at some solutions regarding architecture.
Server:
1. Application Hosted WCF server: Each time you need to manage the server lifecycle. Also, this is not scalable. So if you are looking for scalable architecture, you need to look more.
2. IIS hosted WCF server: This might be a good idea along with some architecture concerns as per your need.
3. Web Method: Obviously this came after WCF, but WCF is still in its place. So the main difference is at What is the difference between an asp.net web method and a wcf service?

Now Client:
1. ASP.NET: This will enable to use a single client app for every platform obviously because of HTML
2. WPF/WinForms: This is going to bit tricky to use as client as you need to deploy the client app on user machine and here comes the data security problem. In former you can directly use SSL or some other way to send data to browser. While in this if you are not using WCF with HTTPS and there are some proprietary data going over wires, it may be concerns.

If you are looking for cross platform usage of your server you can use HTML.

Conclusion:
You can use Server as WCF hosted service (either in IIS or in self contained application) and client as ASP.NET.
-----------------------------
If it is not big enough requirement then you can use ASP.NET as server and then browser as client (No need to create client).
----------------------------
You can create server either as WCF as web methods and deploy the client on user machine.
----------------------------
WCF is nice enough and it can handle your proprietary data types as well.

Community
  • 1
  • 1
Chaturvedi Dewashish
  • 1,469
  • 2
  • 15
  • 39
  • Client will be a WinForm app. Actually I want to make an web client too. So I will try to use WCF. Thank you for your advice. – Gleb Oct 30 '14 at 04:33
1

WCF is a nice thing, but i would use ASP.Net Self-Hosted Web-API. It's more modern. And you have a full rest interface, which is much more popular.

Here is a comparison: WCF and ASP.NET Web API

Here is a good starting point: Self-Host ASP.NET Web API 1 (C#)

Wojciech
  • 199
  • 9
BendEg
  • 20,098
  • 17
  • 57
  • 131
  • 1
    WCF is quite modern, it's just primarily geared towards SOAP (and a replacement for .NET remoting as well). WebAPI is *newer*, not more modern, and more popular for *http* transport scenarios (especially among mobile platforms). – Tim Oct 29 '14 at 10:35
  • You are right, both are modern. But i think it is easier to access the WebAPI from different devices. – BendEg Oct 29 '14 at 10:49