自托管可以在SignalR的树莓派工作? [英] Can self hosted SignalR on the Raspberry Pi work?

查看:361
本文介绍了自托管可以在SignalR的树莓派工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想有一个C#/单声道/基于signalR网站托管在树莓派页面 - 这是可能的。

I want to have a C#/mono/signalR based web page hosted on the Raspberry Pi - is this possible?

我已成功地编写一个客户端 - 服务器其中signalR集线器上的PC上运行托管解决方案-client IIS 8.关于PI控制台应用程序连接到与C#signalR客户端服务器枢纽。在asp.net服务器也承载了遥控器页面,浏览器客户端发送指令到PI但现在我想以消除PC作为一项要求,并有托管的PI的一切。

I have managed to write a client-server-client solution where the signalR hub is hosted on a PC running IIS 8. A console app on the pi connects to the server hub with the c# signalR client. The asp.net server also hosts a 'remote control' page for a browser client to send commands to the pi but now I want to eliminate the PC as a requirement and have everything hosted on the pi.

推荐答案

TLDR

这是可以做到! 影片代码的。

It can be done! Video. Code.

长的故事

我得到了一个解决方案,用的南希,SignalR和基于web服务器OWIN NoWin 从上Rasperry丕一个控制台应用程序(单3,硬浮动)上运行。看到在此溶液中的RPi.Nancy项目

I managed to get a solution working with Nancy, SignalR and the OWIN based webserver NoWin running from a console app on the Rasperry Pi (mono 3, hard float). See the RPi.Nancy project in this solution:

的https:// github上.COM / neutmute / RPi.Demo

相比,是一个纯粹的客户端连接到IIS SignalR主持人,PI为自托管的Web服务器是有点更laggy。从knockout.js约束范围滑块的响应速度非常慢服用几秒钟的更新的流通过它停止移动客户端上之后,完成馈送到服务器。在PC上运行相同的自托管的服务器还演示了一定的滞后性,但不能作为对皮一样慢。

Compared to being a pure client connected to an IIS SignalR host, the pi as a self hosted web server is somewhat more laggy. The response from a knockout.js bound range slider is very slow taking several seconds for the stream of updates to finish feeding through to the server after it has stopped moving on the client. Running the same self hosted server on a PC also demonstrates some lag, but not as slow as on the Pi.

在运行托管signalR自我,单过程conumes 97 %,而滑动件被拖动和发送signalR事件流。这不,当在纯客户端模式与IIS但是IIS服务器确实遇到高CPU使用率时,有滑块大怒拖动,这样或许PI应该是可以原谅的有点滞后发生为中心服务器。

While running the self hosted signalR, the mono process conumes 97% while the slider is being dragged and transmitting a stream of signalR events. This does not happen when in pure client mode with IIS as the hub server, however the IIS server does experience high CPU usage when there is furious dragging of the slider, so perhaps the pi should be forgiven for a little lag.

我也试过武士刀作为Web服务器,但它跑得比NoWin更慢。

I also tried Katana as the webserver but it ran even slower than NoWin.

注意,完全独立托管SignalR解决办法正常工作,如果人们只在这里和那里派遣一些按键 - 滞后是明显的拖动滑块,只有当来回有事件不断流产生。一种解决方案可以是通过敲除绑定节流从滑块的更新,并降低滑动事件的分辨率。

Note that the entirely self hosted SignalR solution would work fine if one only was sending a few button presses here and there - the lag is apparent only when dragging a slider back and forth and having a continual stream of events generated. One solution may be to throttle the updates from the slider via the knockout bindings and reduce the resolution of the slide events.

还值得注意的是,SignalR当上的pI托管不能使用网络插座当SignalR是在IIS 8.服务器端事件的交通承载它们只提供代替。这是相同的传输在纯客户端模式的时候。

Also of note is that SignalR when hosted on the pi can not use web sockets as they are only available when SignalR is hosted on IIS 8. Server Side Event transport is used instead. This is the same transport when in pure client mode.

这篇关于自托管可以在SignalR的树莓派工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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