Community discussion forum

Create your own Web Server using C#

This is a comment thread discussing Create your own Web Server using C#
  • 9 years ago

    This thread is for discussions of Create your own Web Server using C#.

  • Advertisement

    Simply the fastest line-level profiler for .NET ever

    “The low overhead means it has minimal impact on the execution of my program”
    Mark Everest, Development Team Leader, Renault F1 Team Ltd.

    Try out the new ANTS Profiler 4 for yourself. Download your 14-day trial now

  • 7 years ago

    It's amazing how little code it takes to write a functioning web server these days.  Consider the old MFC samples for comparison.


    You might consolidate your text file parsing code.  The whole semicolon searching system is pretty generic.  Or go with XML like you said.


    You should support the HEAD verb b/c dropping the connection when it's not a GET request will anger many browsers in terms of caching.


    You shouldn't read the whole file into memory using a string concatenation loop.  The socket class probably has a method to efficiently transmit an entire file.  If it doesn't, you should have your loop read a little and write a little, otherwise those multi-megabyte flash and BMP and MP3 files will start to kill your server.

  • 6 years ago

    Even though I am only a VB.NET programer,
    I still understood all the code.
    gotta love .NET!

  • 6 years ago

    How about the POST type,


    I noticed that when client send a POST type,
    only the http headers appear and nothing follows, even there are attachments.

  • 4 years ago

    hello,
    i need to write a service Windows of the base a the same server.
    I am traiyng to use this code in the WinService(c# .NET), but a error was occured:
    the system has stopped listen etc...


    I think the problem is in the
    while(true){...}
    and i think this need make sleep the thread for sometime....

  • 4 years ago

    i find c# more comprehensible then VB.
    for a C# programmer is more difficult for read VB code...

  • 4 years ago

    Hehe, I moved permanently to C# only a month or 2 after
    creating this thread .


    I now have trouble reading VB code. Array access looks like
    function calls, etc...

  • 3 years ago

    This code has no entry point. When compiling, I only get "error CS5001: Program 'c:\MyWebServer\MyWebServer.exe' does not have an entry point defined". I know that it is looking for a "Main()", but I am pretty much a newbie, and I don't know where to add that.

  • 3 years ago

    How do you extend this to enable HTTP data compression?
    header:
    content-encoding=gzip

  • 1 year ago

    I was looking for a web server and came across a couple of other options, of course there is cassni / aka webdev but i tried this http://www.neokernel.com server because it seemed to have good samples for how to configure it for ssl, passwords, etc.

Post a reply

Enter your message below

Sign in or Join us (it's free).