Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

We have a large website running that offers a JsonRpc web service.

For offline demonstration purposes, I want to realize a portable, locally running webserver with a minimalistic feature replication of the live webservice, and bundle this together with Html files which do Ajax requests to it. This local server executable should have as little dependencies as possible.

It's going to be run and presented by non-devs on non-dev Windows machines, so I would prefer having a simple executable plus the service code. The language would need to be .NET, PHP or Java.

I'll need a small database behind which probably will be Sqlite.

It's important to say that, for reasons I won't get into here, we cannot use the original web service code, but we have to rewrite it new for the local demo server. This is why I want to put minimal effort in the local server tech.

An installer for distribution is not mandatory, it's okay to have a zip file with an executable in it which starts up the local webserver.

What would you recommend realizing these requirements?

share|improve this question
1  
I use XAMPP Lite for demos, running it in a USB drive. –  Yannis Rizos Sep 7 '12 at 10:36
    
Do you know what version of IE they're likely to have (non-devs on no-dev Windows machines to me means no firefox/chrome, but you would know better) One option could be to use HTML5 storage / offline cache (use static HTML files for your ajax requests) but past experience is it'll be a few more years before you can count on the IE on non-dev's desks supporting this. –  Foon Sep 7 '12 at 11:58
    
Having them install Firefox or Chrome wouldn't be a problem. But what I definitely need is some kind of server - because there's some Flash with "hard coded" json requests, where I'm only able to configure the server address. –  derFunk Sep 7 '12 at 15:02
add comment

6 Answers

Tomcat is a great stand-alone web server for Java apps. It's small, fast, and the reference implementation for the Java Servlet Specification.

I don't know enough about PHP and .NET to suggest small web servers servers that are especially friendly to those technologies.

share|improve this answer
add comment

Jetty is a good choice if you can package your files as a WAR.

Jetty provides an HTTP server, HTTP client, and javax.servlet container. These components are open source and available for commercial use and distribution.

--From Jetty's website

share|improve this answer
add comment

If you want to go the .NET route, a few lines of code is all it takes to spin up a Self-Hosted Web API instance. It can be run in a console app, or with a few more lines of code it can be installed as a Windows Service.

share|improve this answer
    
This is a great find I'll look into further, thanks! –  derFunk Sep 11 '12 at 8:10
add comment

Then you want a self-contained binary. That means you really want to write your code using a web service library that can be compiled into your program.

Now you just need to decide which one! You could use node.js, but that requires node + some javascript codefiles to be deployed. However, as you already have html files you only have to deploy a directory with an batch file to run it all. Node is a good choice if you want to emulate a client too as it can come with a heap of nice javascript libs such as express.

You could write it in .NET but you'd have to be careful of using the .NET runtime that goes with the server you're running it on - you do not want a huge .NET framework download, nor do you want to have to deploy all the windows updates for it (but you do want to deploy all the security updates, obviously).

You could write it in C++ using Windows Web Services or gSoap (nice and fast too) and deploy just a single .exe, but I've never seen one deployed with all html and resources compiled into a single exe - its possible though, serve these files from inside the exe resource block.

SQLite is an excellent choice BTW.

share|improve this answer
add comment

If you're fine with it being PHP and only being on Windows, I can definitely recommend Server2Go (http://www.server2go-web.de/). It let's you run a full WAMP stack, with options to, for example, keep changes to the DB over time or reset it each time the application is run, plus auto loading a browser if you want.

share|improve this answer
add comment
up vote 1 down vote accepted

Thanks for all your suggestions!

Finally I decided to go with the Mongoose stand-alone webserver which supports all kind of cgi plugins, including PHP. It's easily configurable and deployable and just fits my needs.

On my research I also found the UltiDev Web Server Pro, which was on the short list if I'd decided to go with .NET. Seems to be a nice product, but havn't worked with it yet, maybe it comes in handy for anyone who reads this.

The reason to go with PHP was that it requires a lot smaller footprint than .NET would have needed - in terms of files in the file system. I can put everything I need on the server side into one PHP file, no need for DLLs and other dependencies.

Cheers.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.