开发者

Way to add a web interface to a server?

Question: I have a mailserver written in C# and want to add a web-interface.

Now the way I see it, there are two possibilities:

1) Somebody want's to integrate the mailserver on his o开发者_JAVA技巧wn webpage/webapp --> needs WebService interface

2) Somebody wants to access the mailserver via a web-interface, e.g. on localhost for configuration, but maybe also for writing and reading email.

What's the best way to unify these 2 demands? I mean with 2), the mailserver basically needs his own webserver, listening on port 80 or n, where it displays a page that e.g. ideally uses the WebService to integrate the webserver funcionality into the integrated webserver-webpage. But said integrated webserver should not interfere with an ordinary webserver, if running on that machine.

Also there is the problem of ports and firewalls on the client side and in corporate networks.

Is that feasible/a good idea, or are there better ways?


You could use SOAP to expose all the data as a web service. .NET integrates this very well.


There are a few ways to go here. Probably the most unobtrusive way that won't interfere with an existing Web server would be to have your Mail server create a HttpListener on a port that the Web server isn't using (something like 8080 or 8008, etc.). It can then listen for requests and send down whatever data or HTML pages you like.

The drawback to that approach is that you lose all the convenience that ASP.NET gives you on the server. For a simple Mail server that's just returning data, that's no problem. For reading and writing emails, it's a lot less convenient, but still doable. After all, there are plenty of Web-based email apps that use pretty primitive HTML pages for presentation.

You can get more information about using HttpListener in A Simple HTTP Server.


They use the standard port 80 unless specified otherwise.


Nowdays .NET provides SOAP and JSON interfaces through the same [WebService] class. So deploying Web Application will solve both problems for you.

Single problem still here is how to interoperate between mail and webmail application domains. And this is the question of your mailserver architecture.

From my experience its hardly possible to run ASP.NET infrastructure from within your own application.


I think IIS7 will let you host a service that listens on any TCP port using any encoding (not just HTTP) in it, so you could host your service in ASP.NET then exposes pages and WCF (soap) end points.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜