如何扩展从StatelessService在服务织物ASP.NET 5派生类 - 基于服务? [英] How do I extend class derived from StatelessService in Service Fabric ASP.NET 5 - based service?

查看:108
本文介绍了如何扩展从StatelessService在服务织物ASP.NET 5派生类 - 基于服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法从ASP.NET 5订阅演员盛会 - 基于服务?我看到了类似的功能在服务织物的dotnet-数据streaming-的WebSockets 样本,但样本使用基于OWIN的Web服务,它有 PublicGateway StatelessService 派生类其中一个可以连接到服务任务RunAsync 覆盖。我还没有发现在ASP.NET(5)任 StatelessService 派生型 - 基于项目code。好像它是自动生成的,如果寻找到项目ServiceManifest.XML?

Is there a way to subscribe to an actor event from ASP.NET 5 - based service? I saw similar feature in service-fabric-dotnet-data-streaming-websockets sample, but the sample uses OWIN-based web service and it has PublicGateway class derived from StatelessService where one can hook to the service Task RunAsync override. I haven't found any StatelessService-derived type in the ASP.NET 5 - based project code. Seems like it's auto-generated, if to look into the project ServiceManifest.XML?

我想实现的目标是与样品相同的 - 我要订阅事件从演员的服务,通过SignalR枢纽它们发布

The goal I'm trying to achieve is the same with the sample - I want to subscribe to events from actor service to publish them through SignalR hub.

推荐答案

您所看到的不同之处在于OWIN(武士刀,是precise)样品是服务可靠的面料服务 - 写在一个服务服务API面料 - 使用武士刀打开HTTP侦听器。 ASP.NET的5(现在称为ASP.NET核心1)项目你看到的就是我们所说的嘉宾主持,这是由服务承办布一个独立的EXE,但没有实现任何服务织物的API。它的完成目前这种方式的原因是因为目前ASP.NET核心1的托管模式,很难打开Web服务器编程就像我们做的武士刀。

The difference you're seeing is that the OWIN (Katana, to be precise) sample is a Service Fabric Reliable Service - a service written on the Service Fabric API - that uses Katana to open an HTTP listener. The ASP.NET 5 (now called ASP.NET Core 1) project you're seeing is what we call a "Guest Host" which is a separate EXE hosted by Service Fabric but doesn't implement any of the Service Fabric APIs. The reason it's done this way currently is because the current ASP.NET Core 1 hosting model makes it difficult to open a web server programmatically like we do with Katana.

然而,这个正在改变。 ASP.NET核心1的RC2即将推出将让你轻松编程方式启动Web服务器,类似于我们用武士刀做的方式,所以你可以写在服务织物API服务,并从打开一个ASP.NET核心1服务器服务。下面是使用RC2版本的例子: https://github.com/weidazhao/Hosting

However, this is changing. The upcoming RC2 of ASP.NET Core 1 will let you easily start a web server programmatically, similar to the way we do it with Katana, so you can write a service on the Service Fabric API and open an ASP.NET Core 1 server from the service. Here is an example using the RC2 build: https://github.com/weidazhao/Hosting

这是说,你不一定需要是一个可靠的服务里面挂接到演员的事件。在集群中运行的任何code可以通过可靠的演员的NuGet包拉(Microsoft.ServiceFabric.Actors),并使用ActorProxy API做到这一点。您可以在客户主机服务做到这一点,你就不会有RunAsync为切入点,做到在

That said, you don't necessarily need to be inside a Reliable Service to hook into actor events. Any code running in the cluster can do it by pulling in the Reliable Actors NuGet package (Microsoft.ServiceFabric.Actors) and using the ActorProxy API. You can do this in a Guest Host service, you just won't have RunAsync as an entry point to do it in.

这篇关于如何扩展从StatelessService在服务织物ASP.NET 5派生类 - 基于服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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