Integrate an E-Mail server into 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)
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.
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
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.
精彩评论