Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web Service or DLL?

I'm creating an app that needs to be accessed by both a web front end hosted on an internal network and also run as a scheduled task. Nothing will need to be accessed outside of our internal systems and once the app is up and running we don't envision anything changing for some time.

My initial thought is to create a DLL encapsulating the bulk of the necessary functionality and then call it via both a Web Forms interface for manual execution, and a console app running as an automated (daily) scheduled task.

Another suggestion has been to expose a Web Service for the core functionality instead, but as the app will never need to be called by an external resource I think the extra effort required in implementing a Web Service might not be worth the hassle. The DLL solution should also be substantially faster(?).

My question is which route would you choose? Are there any pros/cons that I haven't covered? Any glaring omissions?

Disclaimer: I'm new to .Net but due to one of our developers being involved in a serious accident I've been asked to step up to the plate.

like image 586
James Marshall Avatar asked Nov 18 '08 16:11

James Marshall


People also ask

What is the difference between an API and a Web Service?

Both APIs and web services are technologies that enable the transfer of data between separate software applications. API is an interface that exposes an application's data to outside software, whereas web applications are one type of API with stricter requirements.

What is Web Service in C#?

Introduction. Web Service is known as the software program. These services use the XML to exchange the information with the other software with the help of the common internet Protocols. In the simple term, we use the Web Service to interact with the objects over the internet.

Is .NET a Web Service?

NET, is a component that resides on a Web server and provides information and services to other network applications using standard Web protocols such as HTTP and Simple Object Access Protocol (SOAP). . NET Web services provide asynchronous communications for XML applications that operate over a .


3 Answers

Personally, I say go with the DLL. It will be fast and simple.

With a web service, you will need to think about your network, firewalls, performance, etc. It also makes it harder to debug since you won't be able to step into the web service from your clients, you will have to set breakpoints on both sides of the calls.

The other problem with web services for you is that you need to be much more robust handling failures. With a DLL, you know a call to a method is going to succeed, but with a web service, you will need to be prepared for that call to fail or time out whenever you make any call across.

Lastly, if you find a need for a web service at a later date, you should be able to fairly easily convert the DLL into a web service with minimal retrofitting.

like image 134
Rob Prouse Avatar answered Nov 15 '22 19:11

Rob Prouse


Right now there is no need to create a webservice. You just would have to maintain an other IIS service on your server. If you later on create some interface that will need that DLL you can simply refer to it. So there is no need to do it preventative.

like image 32
MrFox Avatar answered Nov 15 '22 20:11

MrFox


You're right, web services are a lot of hassle from experience and much slower. I suggest - do a PONO (plain old .net object), but use interfaces. Look into Spring.NET framework - it can export this object for you as whatever type of (web) service, so you don't need to do the plumming. On the client side, you can also use spring to do the dependency injection and decide if you want in-process DLL or web service implementation, just by changing value in the config file. Also Spring has Quartz scheduler integration, you might want to look into it too.

like image 31
Paul Kapustin Avatar answered Nov 15 '22 21:11

Paul Kapustin