简体   繁体   中英

WCF service, WCF Data Service, Web Api, SignalR? What to use?

I know there might not be one simple answer for this, but i was hoping if somebody can point me in the right direction...

We have an ASP.NET webforms application with its own MS SQL database at our company's office, but now we want to show some data in this application from another MS SQL database, which is not at our company's office. We need to request the data server-side, so not directly from the webbrowser.

We don't want to use a direct sql connection to this remote database, but prefer to create a service which can do some business logic before returning the data. Business logic is very simple (such as retrieving some values end returning the average).

A couple years ago we did almost the same by writing a WCF service with a BasicHTTPBinding.

But now, after doing a couple hours of research, i'm a little bit confused about whats the best approach?

  • WCF Service
  • WCF Data Services
  • ASP.NET Web API
  • SignalR

Maybe somebody can give me some good tips?

You're looking for machine-to-machine communications, in which case WCF still beats the rest in my experience.

You simply define data contracts for the entities you wish to exchange and happily code your logic in the WCF service. Then you generate a client, apply the proper binding (given machine-to-machine, net.tcp looks like an efficient candidate) and off they talk.

As for the rest: WCF Data Services - works nice if your data model matches the database model, which hardly ever is the case. When you need custom operations or wish to return different entities than database entities, Data Services are more cumbersome than plain WCF.

ASP.NET Web API and SignalR are mainly meant to consume from a browser. It's harder to generate a strongly-typed client for those.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM