Search code examples
c#.netweb-servicescassini

How can I configure Cassini web server to accept requests to different hosts?


See duplicate: Customizing the cassini webserver


I have a web service hosted using Cassini web server. It works fine if I reference it by localhost, but when I use my machine's name (even using the browser locally), I get:

Server Error in '/' Application.
HTTP Error 403 - Forbidden.
Version Information: Cassini Web Server 1.0.40305.0 

How can I configure it to accept all requests?


Solution

  • Cassini is specifically build to reject any outside connections. You could rebuild from sourcecode if you want it to accept outside connections.

    Edit:

    In reply to the below comment on what to edit in the sourcecode, you'd probably want to change the following in Server.cs on line 88:

    _socket = CreateSocketBindAndListen(AddressFamily.InterNetwork,
                 IPAddress.Loopback, _port);
    

    Into something like this:

    _socket = CreateSocketBindAndListen(AddressFamily.InterNetwork,
                 IPAddress.Any, _port);
    

    This will bind the listening socket to all available IP addresses on the system instead of only to the localhost address (127.0.0.1).