Call a function/event or pass data to Website(C#)

2019-06-13 15:24发布

I have one windows application which is listening to events of a device attached(on USB port) and passing event name to web service(In Real Time). And I have a website on which I want to perform certain operations according to the event of device(In Real Time).

So I want to pass data or call function on website whenever a new event value is passed from windows application.

I tried to use timer on web page which is calling Web-service to get latest value. But the problem is that events are changing very rapidly.

Is there any way that web-service automatically send some data to my website? or any other solution.

Thanks in advance

1条回答
何必那么认真
2楼-- · 2019-06-13 16:00

With the best of my knowledge, I think you cannot just directly pass the data on your website from the web service, since the service itself doesn't know to which it is connected with.

For your scenario what I will do is, make a database with some required tables in it and store the data in there from a web method whenever it is called by your windows application, since your application is entirely built on .NET you can simply pass the DataTable object without having to parse the XML data on the other side. Now, make a web method that will return this data from the database. Call this web method from your website. When the data has been sent to the website, you can however delete it from the database so that the new data can then be sent in the next call.

It might help you!

查看更多
登录 后发表回答