Andy Faibishenko
Andy Faibishenko

Reputation: 651

Microsoft technology similar to Java EE servlets?

I have a java application which runs under Tomcat. Fairly simple architecture - users invoke a servlet through HTTP which then puts a request onto an in memory queue. A consumer thread which was started as a ServletListener and is running continuously polls the queue and processes the requests which includes calling some stored procs and sending some data over socket connections to backend systems.

I may need to port the code over to C#. What I am trying to figure out is what is the equivalent technology in Microsoft land which will allow me to architect the same system. The porting of the code from Java to C# will be trivial, but what I can't seem to find is an application server technology from MS which will allow me to drop in my code and then declaratively specify that I want a new "servlet" for each HTTP call, and that I need to run a "daemon" thread in the same process, etc...

Any advice? I am not very familiar with the MS landscape...

Upvotes: 5

Views: 2821

Answers (4)

user215054
user215054

Reputation:

The vendor, who will make standardized, transactional, container based .NET server with all Java EE concepts like Servlets, MDBs and resource connectors working with less than 1 million config files will win.

Upvotes: 0

Wim ten Brink
Wim ten Brink

Reputation: 26682

If you're unfamiliar with the Microsoft environment then don't expect to learn things quickly, since running a web site/service is far more complex than most people think. That is, if you want to run a secure environment.

First of all, I do wonder why you're moving to C# and IIS. Apache runs perfectly on Windows too, and it wouldn't surprise me if you can get everything running in the same way on a Windows system.

But if you do want to move towards C# and Windows development, start by reading some technical books first! O'Reilly has some excellent books about C# and .NET, including titles like "Learning WCF", "Programming Entity Framework" and "Programming ASP.NET 3.5" which should provide enough information for moving to .NET.

However, it will be different from what you're used to. The design patterns are similar, the names and techniques do differ though.

I'm not a Java guy, though. So I don't know what it is you want to do here...


Looking at your comment and desires, it seems that what you're building is a messagequeue system, where requests are sent to a queue on the server, waiting to be resolved. Windows has some good build-in functionality for that, although it might not be exactly what you're looking for. Still, the principle would be simple: the web interface will add requests to the queue and a Windows service (not a WEB service) will query the message queue for new requests to process these. It makes porting your code from Java to C# a lot less trivial, though!

About the equivalent of servlets in ASP.NET, I think gimel is partly right. An HTTP handler will allow you to generate any kind of response, including non-html pages. I've used them in the past to return data in XML or Excel format to the user. I've also used them to generate dynamic images with additional watermark. But a data service (.svc) might also be a good alternative. (I use one as a RESTful service around an Entity model.) Or just a regular web service(.asmx) could be as practical.

.NET and Java aren't easy to compare at this level. Each has a lot of it's own techniques to handle things. I'd almost think the equivalent of servlets is ASP.NET itself, not a subpart.

Upvotes: 1

gimel
gimel

Reputation: 86362

See what-are-the-correspondent-of-servlet-and-applet-in-net. The accepted answer says:

In .Net, HTTP handlers (.ashx) are probably the closest thing to a servlet.

Upvotes: 2

duffymo
duffymo

Reputation: 308763

I'm betting it's System.Net.HttpListener:

http://msdn.microsoft.com/en-us/library/system.net.httplistener.aspx

But I'm not a .NET guy yet, either.

Upvotes: 1

Related Questions