sambomartin
sambomartin

Reputation: 6813

Recommended architecture - Server application that provides a ASP.NET Web front end

I'm having a look at the best way of developing a server application that presents an ASP.NET MVC front end for management/reporting.

The server app (service?) will also need to provide TCP listener as well as communicate to devices on a COM port.

The most obvious way I can think of doing this is to have an ASP.NET MVC web app and have a windows service that talks to the web app using a web calls/services. I guess then I'd talk to the service using the tcp listener or remoting?

The only other way would be to actually host an web server component in the service, and not use IIS which seems a bit to over the top.

Does anyone have any experience of this/recommendations?

It's a bit open ended but hope I've explained the basics.

TIA

Sam

Upvotes: 1

Views: 398

Answers (3)

mythz
mythz

Reputation: 143369

I started ServiceStack because I needed a high-performance web services framework option that promotes the correct way to develop web services.

ServiceStack can be run on top of any ASP.NET host or self-hosted using the HttpListener option. See the Starter Templates for example projects of a Console App or Windows Service hosts. Although even under IIS, ServiceStack is very fast and imposes very little overhead with a hello world service executing in sub <1ms response times.

ServiceStack also comes with .NET's fastest text serializers and a myriad of high-performance caching providers so you can escape the XML config bound ASP.NET's session and caching provider model.

Because ServiceStack encourages a clean message-based development model your same web services can take advantage of the Redis MQ Host allowing it to be invoked outside of HTTP context using Redis as a broker - with no code-changes required.

Redis is one of the fastest distributed NoSQL data stores.

Upvotes: 1

Paul
Paul

Reputation: 36339

I would probably try and decouple things a bit more.

Start off w/ a core project where all your business logic lies (agnostic of how users interact with it); sort of the DDD Domain Model idea.

Then, create two projects which consume that core project, one that is your MVC app, and another that's a WCF or ServiceStack-based service which can handle your TCP stuff.

Share state between them using the normal means; either inter-process comms, shared database, etc.

Upvotes: 2

jwheron
jwheron

Reputation: 2572

It sounds to me like you're looking for something very close to Windows Communication Foundation. Your requirements for IIS hosting, ASP.NET communication, and TCP communication. MSDN has a brief overview of WCF up here. There's also an article available about the transportation protocols here.

There are some good -- if a little old -- WCF questions here on Stack Overflow. I've just started delving into this world myself, and I have to admit that it's daunting at first. The Beginner's Guide (found under the first hyperlink above) has some slightly old, but very useful tutorial videos about WCF.

I will say that, although it may seem daunting or difficult, it's certainly better to use an existing, established technology for your purposes than to try to write your own homebrewed solution for something like this.

Upvotes: 1

Related Questions