微服务和 .NET

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26331854/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 12:49:47  来源:igfitidea点击:

Micro services and .NET

.netmicroservices

提问by netdeveloper62

How to build micro service oriented application in .NET world? Are there any platforms where we can write micro service oriented apps in .NET world? How to envision architecture that includes Micro services, Event store and some of NoSQL databases? Thanks.

如何在 .NET 世界中构建面向微服务的应用程序?在 .NET 世界中,是否有任何平台可以让我们编写面向微服务的应用程序?如何设想包含微服务、事件存储和一些 NoSQL 数据库的架构?谢谢。

回答by Paul Mooney

Follow this linkfor a step-by-step guide to setting up a simple Microservice framework using the .NET framework, ASP.NET, and RabbitMQ.

按照此链接获取使用 .NET 框架、ASP.NET 和 RabbitMQ 设置简单微服务框架的分步指南。

The tutorial starts with the core concepts, implements a working application, and scales that application in terms of size and complexity, tackling typical Microservice problems during each step.

本教程从核心概念开始,实现一个工作应用程序,并根据大小和复杂性扩展该应用程序,在每个步骤中解决典型的微服务问题。

回答by Fidel Orozco

Microservices is more an architectural approach than framework or a set of libraries. But in .Net world you can create independent process for web services using the OWIN (Open Web Interface for .NET).

微服务更像是一种架构方法,而不是框架或一组库。但是在 .Net 世界中,您可以使用 OWIN(.NET 的开放 Web 界面)为 Web 服务创建独立的进程。

You can see an example for implementing a self hosting web service (it do not requires IIS) in:

您可以在以下位置查看实现自托管 Web 服务(它不需要 IIS)的示例:

http://www.asp.net/web-api/overview/hosting-aspnet-web-api/use-owin-to-self-host-web-api

http://www.asp.net/web-api/overview/hosting-aspnet-web-api/use-owin-to-self-host-web-api

With that, you can implement your microservices like self-hosting services in one or more machines. The kind of database or event source is up to your application.

有了它,你就可以在一台或多台机器上实现你的微服务,比如自托管服务。数据库或事件源的类型取决于您的应用程序。

Then you can build some API Rest queried by your application, used like a central point of acces, a Facade pattern, every request will be turned to one of your minions-microservices.

然后你可以构建一些由你的应用程序查询的 API Rest,用作访问的中心点,门面模式,每个请求都将转向你的一个 minions-微服务。

回答by iandayman

Microsoft have released Service Fabricwhich gives you a platform for Microservices.

Microsoft 发布了Service Fabric,它为您提供了一个微服务平台。

It is an Azure offering but will also be available on-premise with Windows Server 2016.

它是一个 Azure 产品,但也可以在本地与Windows Server 2016 一起使用

You can install Service Fabric on a dev machine running VS2015 and try it out using the SDK.

您可以在运行 VS2015 的开发计算机上安装 Service Fabric 并使用SDK 进行试用。

回答by MeTitus

Since the protocol of choice when working with microservices is HTTP, I would recommend .NET Web API for the API layer. Since microservices respect the 4 tenants of SOA, you will want to make sure that every service has its own data storage and that every "service" can be deployed independent. I would say that the most import aspect when setting up an architecture is related to the API contracts, because every service can have it's own implementation.

由于使用微服务时选择的协议是 HTTP,我建议 API 层使用 .NET Web API。由于微服务尊重 SOA 的 4 个租户,您需要确保每个服务都有自己的数据存储,并且每个“服务”都可以独立部署。我想说的是,设置架构时最重要的方面与 API 合同有关,因为每个服务都可以有自己的实现。

.NET Web API + NServiceBusdo provide a nice foundation for an architecture based on microservices.

.NET Web API + NServiceBusdo 为基于微服务的架构提供了良好的基础。

回答by Marcin Waligora

Please have a look at. Please note that this is a hot topic and things are changing daily. Right now the core movement on micro-services is happening mostly in Java world.

请看一看。请注意,这是一个热门话题,而且每天都在变化。目前,微服务的核心运动主要发生在 Java 世界。

http://blog.pivotal.io/pivotal/case-studies-2/tech-start-up-lessons-micro-services-architecture-with-net-and-rabbitmq

http://blog.pivotal.io/pivotal/case-studies-2/tech-start-up-lessons-micro-services-architecture-with-net-and-rabbitmq

http://abdullin.com/post/how-micro-services-approach-worked-out-in-production/

http://abdullin.com/post/how-micro-services-approach-worked-out-in-production/