将电子邮件服务器集成到 ASP.NET 中
我有一个一般性设计问题:
我有一个用 C# 编写的邮件服务器。
然后我有一个网络论坛软件,是用 C# 为 ASP.NET 编写的。
现在我想将邮件服务器集成到 ASP.NET 论坛应用程序中。 例如,我想让人们可以从论坛创建一个邮件列表,并为用户提供将自己添加到论坛中的邮件列表成员的机会,然后将新的列表成员添加到相应的邮件列表中服务器。
由于服务器是一个单独的控制台/winforms/服务应用程序,因此我首先认为最好使用 .NET 远程处理。
但我的第二个想法是,某些用户可能会将他们的论坛托管在
(a) 他们没有可以做他们想做的事情的虚拟机
(b) 主机管理员可能不想安装额外的邮件服务器或为此收取额外费用
(c) 用户可能有一个服务计划,只允许添加网络应用程序,而不允许添加外部程序(很可能)
现在,我想问:
是否有可能以某种方式将邮件服务器完全集成到 ASP.NET 应用程序中? (我有服务器 + ASP.NET 应用程序的完整源代码)
好吧,它可能不会是页面或 ashx 处理程序,而是类似 http 模块的东西? 或者将 TCP/IP 应用程序集成到 asp.net 中的一般方法是什么? (当然,我假设相应的端口可用/转发 - 并且我将可以将其与电子邮件服务器作为外部应用程序一起运行)
I've a general design question:
I have a mailserver, written in C#.
Then I have a web forum software, written in for ASP.NET in C#.
Now I'd like to integrate the mailserver into the ASP.NET forum application.
For example, I'd like to make it possible that one can create a mailinglist from the forum, and give users the oportunity to add oneselfs to the mailinglist members in the forum, and then add the new list-members to the respective mailinglist on the server.
Since the server is a separate console/winforms/service application, I first thought I'd best use .NET remoting for this.
But my second thought was, that some users might host their forum on a host where
(a) they don't have a virtual machine where they can do what they want
(b) the admin of the host might not want to install an additional mailserver or charge extra for this
(c) the user might have a service plan that only permits to add a web-application, not external programs (very likely)
Now, I wanted to ask:
Is it possible to fully integrate a mailserver into an ASP.NET application somehow ?
(I have the full source of the server + ASP.NET application)
Well, it probably won't be a page or a ashx handler, but something like a http module ?
Or what's the general way to integrate TCP/IP applications into asp.net ?
(Of course I'm assuming the respecive ports are available/forwarded - and I'll make it possible to also run it with the e-mail server as external application)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在理想情况下,我会执行以下操作:
在您自己的服务器上进行设置并公开您的 Web 应用程序将/可以与之交互的 WCF/Web 服务。
如果您无法或不想负担其自行运行的费用,则可以收取订阅费。
In the ideal case I'd do the following:
Set it up on your own server(s) and expose a WCF/web service that your web app will/can interact with.
If you can't or don't want to afford to keep it running on your own, you could then charge a subscription fee for it.
这可能不是一个很好的主意,但您可以在 Global.asax 中启动一个线程,并在应用程序池运行/Web 应用程序未重新加载时进行后台处理。所以你可以在那里启动你的服务器,但你无法控制它的生命周期
It's probably not a very great idea, but you can start a thread in Global.asax and do background processing while the application pool is running/the web app is not reloaded. So you could start your server there, but you have no control over the lifetime of it
添加到 chris166 的评论...您也无法控制应用程序何时启动。 [因为在请求页面之前不会加载应用程序...] 在 Web 应用程序和控制台/服务应用程序之间设置某种集成可能是一个更好的主意。
我可能倾向于建立一个近乎实时的集成,其中邮件服务器轮询论坛应用程序以获取请求的更改。
Adding to chris166's comment... you also wouldn't get control over when the application is started. [Since the application won't be loaded until a page is requested...] Its probably a better idea to setup some sort of integration between the web app and the console/service app.
I'd probably tend towards setting up a near-realtime integration where the mailserver polls the forum app for requested changes.