Does SignalR or websockets works with ASP.NET CORE

2019-07-29 08:01发布

I need to implement realtime data sharing push based to my asp.net core 1.0 web application. i.e. If any new data is available I want to push it to all the connected clients/logged in users. I was considering SignalR & websockets for it but SignalR works on .net core 2.0 and websockets works on .net core 1.1 version.

Here is the configuration in my csproj file

<PropertyGroup>
  <TargetFramework>netcoreapp1.0</TargetFramework>
  <RuntimeFrameworkVersion>1.0.4</RuntimeFrameworkVersion>
  <PackageTargetFallback>$(PackageTargetFallback);dotnet5.6;portable-net45+win8</PackageTargetFallback>
</PropertyGroup>

Is there any alternate option? or else I'll have to upgrade it to 1.1 or 2.0 to achieve this.

Also I went through some articles here, which uses signalR but package.json shown in this article says netcoreapp1.0 which creates confusion for me. if the author of this article can use SignalR with .net core 1.0 then why does documentation mentions 2.0 am I missing anything here ?

"frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  }

I am new to .net core so anyone guiding me to correct path would be really helpful. Just help me correct my understanding I can take care of the implementation part Thanks

2条回答
来,给爷笑一个
2楼-- · 2019-07-29 08:16

There is no supported version of SignalR for ASP.NET Core 1.x. Initially, the SignalR 2.2.x was ported to ASP.NET Core but it was never shipped. Then it was decided that SignalR would be rewritten and the port was abandoned and never will be (nor was) supported. The ASP.NET Core version of SignalR that is under development required ASP.NET Core 2.0.

查看更多
一夜七次
3楼-- · 2019-07-29 08:30

Yes it does. I am currently using it with ASP.NET Core 1.1.2

Get the package

Microsoft.AspNetCore.SignalR.Server: 0.1.0
Microsoft.AspNetCore.WebSockets.Server: 0.1.0

from the nuget repository: https://www.myget.org/F/aspnetmaster/api/v3/index.json

If you are using visual studio, add the above as a package source

For older versions (1.0), you may have to use a different package. Check the nuget repository to check what is available to you

查看更多
登录 后发表回答