views:

967

answers:

4

Hello,

I'm developing an application that is so far using HttpListener to provide a small standalone http server. However, I've recently discovered that HttpListener needs to be run as Administrator, which is not always going to be possible.

What would the best alternative be? I need http GET and POST, both of which are not simply reading/writing files on the filesystem, they need to run custom .Net code.

My research so far has brought up Cassini, but as far as I can tell, I would have to write a custom version. Is there anything else? In partiular something with the same interface as HttpListener, but that does not require Administrator privileges would be amazing!

A: 

One solution to this is covered by this other question - you can give yourself permissions to run HttpListener as a non-admin.

You could get the app to be started from a command file that sorts out the permissions and then runs the real app.

Chris Kimpton
This isn't really an option as the application needs to be as easily installable as a regular desktop application.
Groky
A: 

Ok, so you have a regular desktop app that needs to allow inbound http connections - hmm - won't windows firewall be an issue?

Assuming not, it sounds almost like a webservice - could you go that route - expose the URLs via that? Although my .Net knowledge is not deep enough to know if you still need to run a specific http server to answer requests. Spring.Net is probably worth a look.

Chris Kimpton
No, it will only be receiving connections from localhost - the application is a proxy for an Adobe AIR application which is installed at the same time.
Groky
Also, I've considered webservices but the server will be mainly serving binaries, which is not a good fit for webservices.
Groky
+1  A: 

I also found this little fellow, which might help you - Http

Chris Kimpton
+2  A: 

One alternative that I've found is C# Webserver on CodePlex.

"... a flexible http server which can be embedded in any .Net application. It has a modular design where features are added using modules. The server also supports REST and all http verbs ..."

It has an HttpListener class which I imagine is similar to System.Net.HttpListener, but I haven't used either one of them yet so I can't be certain.

Kevin Thiart
I believe it is socket-based, not needing admin priveleges.
Kevin Thiart
woops, Chris Kimpton's link points to the same project, only on CodeProject instead of CodePex.
Kevin Thiart