简体   繁体   English

托管面向服务的架构

[英]Hosting service oriented architecture

In an interview,a questions is asked on soa. 在一次采访中,有人问过soa问题。 Please see below. 请看下面。

I need to develop an application which should be hosted as windows service, web service, desktop application or web as required by the client. 我需要开发一个应按客户端要求作为Windows服务,Web服务,桌面应用程序或Web托管的应用程序。 How do you the design and the approach 您如何设计和处理

I said , in a way WCF tries to achieve the same. 我说过,WCF尝试达到相同的目的。 But he asked what if WCF is not there. 但是他问WCF是否不存在。 I would try to expose service layer on top of business logic ,so that it can be consumed by any. 我将尝试在业务逻辑之上公开服务层,以便任何人都可以使用它。 I knew this is not satisfactory. 我知道这并不令人满意。

Or Do I need to use any hosting api's to be able to do that. 还是我需要使用任何托管API才能做到这一点。 But can they be configurable without changing any code. 但是它们可以在不更改任何代码的情况下进行配置。

Please share your views? 请分享您的看法?

I would still stick with your answer especially if I'm in an interview, in following way. 我仍然会坚持您的回答,尤其是如果我正在接受采访时,采用以下方式。 It depends how interviewer drives the conversation, but following thought process would work, I guess. 我想这取决于访问者如何推动对话,但是遵循以下思考过程才能起作用。

Lets say WCF is not there, then I have to build a mini-WCF myself which solves the problem, how? 可以说WCF不存在,那么我必须自己构建一个微型WCF来解决问题,怎么办? What does WCF provide? WCF提供什么?

  1. It provides a bunch of factories for Channels, hosting, Authentication, etc. Meaning WCF is a Domain Specific Language to write services. 它为通道,托管,身份验证等提供了许多工厂。这意味着WCF是一种用于编写服务的领域特定语言。
  2. It provides certain level of isolation between code (your code) and plumbing required to make authentication, logging, serialization. 它在进行身份验证,日志记录和序列化所需的代码(您的代码)和管道之间提供一定程度的隔离。

Therefore for a given business domain if I build above set of services (might not be as robust, reliable, or configurable as WCF) but solves the business problem, I could potentially make your code hosted in all possible hosting environments. 因此,对于给定的业务领域,如果我构建上述服务集(可能不如WCF那样健壮,可靠或可配置)但解决了业务问题,则有可能使您的代码托管在所有可能的托管环境中。 For each environment I probably have to implement few basic plumbing like activation, channel enablement, with that I can support any future hosting scenarios as well. 对于每种环境,我可能必须实现一些基本的功能,例如激活,通道启用,并且我还可以支持任何将来的托管方案。

With or without WCF the cost difference is not going to be significant if the hosting problems and kind of protocols I'm supporting are limited. 如果有托管问题和我支持的协议种类有限,则无论是否使用WCF,成本差异都不会太大。 Because the cost of writing a service business logic, data access, application interfaces is same, just that plumbing is taken away. 因为编写服务业务逻辑,数据访问和应用程序接口的成本是相同的,所以只需要删除管道即可。

On a second thought, I could ask interviewer is remoting available? 再三想一想,我可以问问面试官是否有remoting if so many of the WCF plumbing is already available there. 如果那里已经有许多WCF管道可用。

Again to back track, lets say if we dont have any of the current technology stacks, then it justifies the cost of investing in a custom stack for the company as it has an opportunity to create such a robust platform, and create standards in the white space. 再说一遍,可以说如果我们不拥有任何当前的技术栈,那么这将证明为该公司投资定制栈的成本是合理的,因为它有机会创建这样一个强大的平台并以白色创建标准空间。

I'm not sure what interviewer was trying to get at, I've asked similar questions to see if the guy can push the technology envelop by building a business case, without really bogging down by limitations. 我不确定面试官会试图达到什么目的,我问过类似的问题,看看这个家伙是否可以通过建立业务案例来推动技术发展,而不会真正陷入局限。

Some of these technologies are completely unlike the others. 其中一些技术与其他技术完全不同。 You cannot write something which is both a good windows service and a GUI application. 您不能编写既是好的Windows服务又是GUI应用程序的东西。 Windows services by definition do not have a GUI. 根据定义,Windows服务没有GUI。 You need to explain to the client they are wasting their money trying to make something which is everything at the same time. 您需要向客户解释,他们在浪费金钱,试图同时制作所有东西。

To give you a concrete example: The same car cannot be both a good snow plow and a good race car. 举一个具体的例子:同一辆车不能既是一辆好的除雪机,又不是一辆好的赛车。 You can make something that is both but it will either be poor at both jobs or very very expensive. 您可以做的事情既可以做,又可以做得很差,或者非常昂贵。

Presentation -> Service -> Business -> Data Access -> Data 演示->服务->业务->数据访问->数据

The Service allows for Business, Data Access, and Data to be configured regardless of how the Presentation is built. 该服务允许配置业务,数据访问和数据,而与演示文稿的构建方式无关。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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