问题描述
SignalR 3和ASP.NET 5人很好,直到同β7版本一起工作。现在微软表示SignalR 3是搁置,而人们不应该指望两到在不久的将来一起工作:
https://github.com/aspnet/SignalR-Server/issues/119
https://github.com/aspnet/SignalR-Server/issues/121
所以,问题:有没有一种方法,使在ASP.NET应用5至少SignalR 2工作
发现本文中使用owin兼容的中间件通用的解决方案:
<一href=\"https://lbadri.word$p$pss.com/2014/11/01/asp-net-vnext-middleware-versus-owinkatana-middleware/\">https://lbadri.word$p$pss.com/2014/11/01/asp-net-vnext-middleware-versus-owinkatana-middleware/
- 引用
Microsoft.AspNet.Owin
包 - 插入下面的code到
Startup.Configure
:
app.UseOwin(addToPipeline =&GT;
{
addToPipeline(下一=&GT;
{
VAR的AppBuilder =新的AppBuilder();
appBuilder.Properties [builder.DefaultApp] =下一个; appBuilder.MapSignalR(); 返回appBuilder.Build&LT; AppFunc&GT;();
});
});
SignalR 3 and ASP.NET 5 were working together nicely up until the beta7 version. Now Microsoft states that SignalR 3 is 'on hold', and one should not expect the two to work together in the near future:
https://github.com/aspnet/SignalR-Server/issues/119
https://github.com/aspnet/SignalR-Server/issues/121
So the question: is there a way to make at least SignalR 2 work in an ASP.NET 5 app?
Found the general solution for using owin-compatible middleware in this article:https://lbadri.wordpress.com/2014/11/01/asp-net-vnext-middleware-versus-owinkatana-middleware/
- Reference the
Microsoft.AspNet.Owin
package - Insert the following code into
Startup.Configure
:
app.UseOwin(addToPipeline =>
{
addToPipeline(next =>
{
var appBuilder = new AppBuilder();
appBuilder.Properties["builder.DefaultApp"] = next;
appBuilder.MapSignalR();
return appBuilder.Build<AppFunc>();
});
});
这篇关于在ASP.NET应用程序5使用SignalR 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!