Web 服务还是 DLL? [英] Web Service or DLL?

查看:21
本文介绍了Web 服务还是 DLL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个应用程序,它需要由托管在内部网络上的 Web 前端访问,也需要作为计划任务运行.无需在我们的内部系统之外访问任何内容,一旦应用启动并运行,我们预计一段时间内不会发生任何变化.

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.

我最初的想法是创建一个 DLL 来封装大部分必要的功能,然后通过手动执行的 Web 窗体界面和作为自动(每日)计划任务运行的控制台应用程序调用它.

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.

另一个建议是为核心功能公开 Web 服务,但由于应用程序永远不需要由外部资源调用,我认为实现 Web 服务所需的额外努力可能不值得麻烦.DLL 解决方案也应该快得多(?).

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?

免责声明:我是 .Net 的新手,但由于我们的一名开发人员卷入了一起严重事故,我被要求加强工作.

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.

推荐答案

就个人而言,我说使用 DLL.它将快速而简单.

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

使用 Web 服务时,您需要考虑网络、防火墙、性能等.这也使调试变得更加困难,因为您将无法从客户端进入 Web 服务,您将需要在调用双方设置断点.

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.

Web 服务的另一个问题是您需要更加稳健地处理故障.对于 DLL,您知道对方法的调用会成功,但是对于 Web 服务,您需要做好准备,无论何时进行任何调用,该调用都会失败或超时.

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.

最后,如果您以后发现需要 Web 服务,您应该能够通过最少的改造轻松地将 DLL 转换为 Web 服务.

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.

这篇关于Web 服务还是 DLL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆