简体   繁体   English

如何在Azure移动服务中添加信号器管道模块

[英]How to add a signalr pipeline module in Azure mobile service

I want to add a signalr pipeline module as described here . 我想描述添加signalr管道模块这里

The article says to add code to startup.cs file but I don't have such a class in my mobile service. 文章说将代码添加到startup.cs文件中,但是我的移动服务中没有此类。 Also, the code uses GlobalHost which from my (limited) experience does not really work inside a mobile service. 另外,代码使用GlobalHost ,根据我的经验(有限),它实际上不能在移动服务中运行。

I tried adding this line in WebApiConfig class but it doesn't work: 我尝试在WebApiConfig类中添加此行,但不起作用:

GlobalHost.HubPipeline.AddModule(new LoggingPipelineModule());

I couldn't find the answer anywhere so I dug in the mobile services signalr assembly and found the solution. 我在任何地方都找不到答案,因此我在移动服务信号器组件中进行了挖掘并找到了解决方案。

To add your own module, add the following code to WebApiConfig : 要添加自己的模块,请将以下代码添加到WebApiConfig

var hubPipeline = config.DependencyResolver.GetSignalRDependencyResolver().Resolve<IHubPipeline>();
hubPipeline.AddModule(new MyModule());

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

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