Can I use SignalR in my Winform c# app?

旧时模样 提交于 2019-12-13 13:27:29

问题


I have a web service being polled every few seconds in my winform c# app. It checks for messages and gets them from my server and/or it relays messages from my desktop app to my server.

The web service is being invoke in an infinite loop which the User can stop and start at the click of a button. When the polling is on the memory goes up and stays up (which I guess I expected using infinite loop). If there was way for my server to notify my client that a message is available then I assume I can get rid of my infinite loop. I was looking at different architectures and I came across SignalR but it seems more geared for asp.net. Is that the case? Or can it be modified to work in my scenario here?

thanks


回答1:


Using SignalR as a client (or server) requires win8+ to get websockets. That should be something you are very aware of before using it. I learned the hard way ;) See support here http://www.asp.net/signalr/overview/signalr-1x/getting-started/supported-platforms




回答2:


See this answer about boosting asmx/WCF to become a push service in 2 lines of code. Push Data from a WCF Service to Website




回答3:


There is a .NET client for SignalR, also you can self host SignalR using Owin

Install package

Microsoft.AspNet.SignalR.Client


来源:https://stackoverflow.com/questions/19701793/can-i-use-signalr-in-my-winform-c-sharp-app

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!