3

I am trying with setting a web service without using IIS.

I knew we can use HttpListener to create simple http server before. I am wondering if it is deprecated now since WCF seems provide more advanced features.

Adam Lee
  • 24,710
  • 51
  • 156
  • 236

2 Answers2

0

Take a look at the HttpListener Class documentation:

This class is available only on computers running the Windows XP SP2 or Windows Server 2003 operating systems. If you attempt to create an HttpListener object on a computer that is running an earlier operating system, the constructor throws a PlatformNotSupportedException exception.

So, if you can use it depends on the operating system you want to run your program on.

Soundlink
  • 3,915
  • 2
  • 28
  • 36
0

Microsoft recommend against using it. I'd go with WCF if you need to know it'll be maintainable for some years.

Alternatively, if you're happy to expose RESTful services rather than SOAP or XML-RPC, there are a few standalone .NET assemblies you can use to host an HTTP server in your app without any dependency on IIS or WCF - they'll run under Mono, too, with no problems:

Nancy - http://nancyfx.org/
Kayak - https://github.com/kayak/kayak
Firefly - http://loudej.github.com/firefly/

We use them to make sure we have complete control over the server stack, and can tweak things outside the parameters of the black-boxes that are .NET's HTTP listeners.

Peter
  • 37,042
  • 39
  • 142
  • 198
Richard K.
  • 2,034
  • 1
  • 14
  • 15