views:

248

answers:

2

I'm creating a distributed application that includes a lot of services and I'm looking for the technology that allows me to create and manage a lot of services easily.

I know managing and deploying windows services is not fun. I'm thinking of using ASP.NET MVC as service host of my services where each controller action becomes essentially a service and I can communicate with a service via simple HTTP request and responses and not have to deal with complexity if i use something like WCF.

Services need to be isolated and asp.net requests are isolated as far as i know, i.e. if a request throws an exception it will not effect other running requests.

But I still have questions about the management of the services. How will it be possible to see which services are running, stopping and resuming services. Also ASP.NET MVC are passive, i.e. they only do something upon a request but what if i want to service that initiates work by itself?

A: 

Lot of questions all wrapped in one. :)

MVC is a presentation pattern, and does not make a lot of sense as a means of designing a service host.

That said, It's very quick and easy to create a service layer with ASP.Net/IIS without using MVC (or Webforms for that matter). In fact, much/all of the functionality you need for stubbing out a service layer in ASP.Net can be easily generated from Visual Studio.

Webservice requests do run as separate threads IIRC, so they will be isolated.

As far as seeing which services are running, I don't know of anything that allows this sort of reporting in IIS. You may need to write updates to a database, log, or other data structure, and then create a UI to read from it.

The services would indeed be passive. You may look at something like Quartz.Net for scheduling tasks, but I'm not sure how reliable it would be to keep it running in the IIS process. The right tool for the job for this kind of thing would likely be a Windows Service or console application.

Phil Sandler
It's certainly a big question:)I agree MVC is for presentation but i chose it because it's closer to the request/response then web forms and I thought i can benefit from it's features to like security/validation than building my own.
Delucia
+1  A: 

We use ASP.Net MVC to create Services that return a JSON result. We host these services in IIS.

MS is building a Server product designed to host WCF services, that you could use for your services, see: http://samgentile.com/Web/dublin/windows-server-appfabric-formerly-dublin-beta-2-is-available/

Shiraz Bhaiji
Thank for link. AppFabric is very similar to what I want however I'm looking for much lighter solution and AppFabric seems to have a lot infrastructure that i don't need. I'm interested more in your ASP.NET MVC Json services and if you are able to monitor them to know if they're alive, etc.
Delucia
You have to monitor it with something that is not on the same machine as your service. If the whole machine goes down you will not get any warning. You could write a program that pings the service, if there is an error it will send you an email, wait one min and start again.
Shiraz Bhaiji