如何在 .NET 中创建接收器应用程序来接受来自 ASP.NET 页面的消息或请求?

发布于 2024-09-30 15:10:23 字数 754 浏览 0 评论 0原文

首先感谢您花时间阅读我的问题。以下是我正在努力实现的目标,以及迄今为止我所取得的成果。

我想要做的是创建一个 Windows 应用程序(或某种服务器)来侦听来自 ASP.NET 应用程序的请求。 Windows 应用程序将被安装,并侦听来自 ASP.NET 应用程序的消息,然后进行一些处理。流程是这样的:

用户下载桌面应用程序并在我的网站上注册他们的 IP 地址。下载桌面应用程序后,ASP.NET 应用程序可以将请求发送到该特定桌面客户端以进行进一步处理。我认为在这种情况下,进一步的处理与分辨率无关,这就是为什么我跳过了有关将进行哪些处理的细节。但如果您认为这很重要,请告诉我,我也会添加这些详细信息。

我研究过创建一个监听请求的 TCP 服务器。因为用户已经在我的网站上注册了他们的 IP 地址,所以我的网站为他们分配了一个唯一的标识符,并将该 ID 与 IP 地址一起存储在数据库中。现在,ASP.NET 站点可以向该桌面应用程序发送请求。

我考虑过为此目的创建一个 TCP 服务器。在研究过程中,我也遇到了 PNRP,它看起来就像我正在尝试做的事情。

你们能推荐一些解决方案吗?或者我应该在哪里寻找这种情况?我应该创建一个简单的 TCPLISTENER 还是可以使用 PNRP 方法?或者其他什么?

基本要求是 Web 应用程序能够与桌面应用程序进行通信。 Web 应用程序将为众多用户提供服务,并且每个用户都将安装一个桌面应用程序。 Web 应用程序将解决哪个用户的哪个桌面客户端问题,该应用程序将维护唯一用户 ID 及其相应 IP 地址的数据库。

预先感谢您的帮助。

First of all thanks for taking the time to read my question. Here is what I am trying to accomplish followed by what I have so far on this.

What I want to do is create a Windows application (or server of sorts) that would listen for requests from an ASP.NET application. The windows application would be installed and would listen for messages from ASP.NET application and then do some processing. The flow is like this:

A user downloads the desktop application and registers their IP address on my web site. After downloading the desktop app, the ASP.NET application can then send requests to that particular desktop client for further processing. I think further processing is independent of the resolution in this case that's why i have skipped over details on what processing would be done. But if you think it is important, please let me know and I will add those details as well.

I have looked into creating a TCP server that would listen for requests. Because the user has already registered their IP address on my web site, my web site assigns them a unique identifier and stores the ID alongwith IP address in database. Now, the ASP.NET site can send requests to that desktop application.

I have looked into creating a TCP server for this purpose. While researching I also came across PNRP and it seems something like what I am trying to do.

Can you guys recommend some solutions or where I should be looking at for this scenario? Should I create a simple TCPLISTENER or may be go with PNRP approach? Or something else?

The basic requirement is for a web application to be able to communicate with a desktop application. The web application would be servicing numerous users and each user would have a desktop application installed. Which user for which desktop client question would be addressed by the web application that would maintain a database of unique user id's and their corresponding IP Address.

Thanks in advance for your help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

超可爱的懒熊 2024-10-07 15:10:23

您可以在桌面应用程序中使用 .NET 远程处理或 Web 服务。对于后者,请使用 WCF 或 WSE。您可以使用 COM 添加 Windows 防火墙规则。

You could use .NET remoting or a web-service in the desktop app. Use WCF or WSE for the latter. You can use COM to add windows firwall rules.

走过海棠暮 2024-10-07 15:10:23

无论您做什么,都要考虑防火墙/NAT。客户端应用程序轮询服务器(启动连接)可能会更容易,否则您尝试在用户计算机中拥有可远程访问的服务器而无需在用户的网络设备上进行一些非常手动的配置,从而引发一系列蠕虫病毒。

一旦你解决了这部分问题,我在你的情况中使用的是.NET Remoting。当时 WCF 还没有问世,当它问世时,它就无法满足我的需求了。 TCP IP 套接字太原始了(我不得不编写太多代码),因此远程处理理想地解决了我的问题(需要一整行代码来设置连接,从那以后一切都是自动的)。

编辑:我使用了一个优秀的第三方库,它使Remoting更加灵活(足够灵活,我仍在等待WCF赶上功能集,以便我停止使用Remoting,但还没有运气! )。查看 http://www.genuinechannels.com/ 以查看它们拥有的所有功能。它包括从服务器到客户端进行调用,这听起来与您需要做的完全一样。一探究竟。

Whatever you do, take firewalling/NAT into account. It might be easier for the client application to poll the server (initiate the connection) otherwise you open a can of worms by trying to have a remotely-accessible server in your user's computer without having to do some very manual configurations on the user's networking equipment.

Once you have that part sorted out, what I used in your situation was .NET Remoting. At the time WCF had not come out and when it did it was to crippled for my needs. TCP IP sockets were too raw (I had to write too much code) and so Remoting solved my problem ideally (a hand full lines of code to set up the connection, and everything was automatic from there on).

EDIT: I use an excellent third party library that makes Remoting even more flexible (flexible enough that I am still waiting for WCF to catch up with the featureset so that I stop using Remoting, and no luck yet!). Check out http://www.genuinechannels.com/ to see all the features they have. It includes making calls from server to client, and that sounds exactly like what you need to do. Check it out.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文