CassiniEx Web Server Version 0.94.401 Copyright (c) 2004 SystemEx.NET http://www.systemex.net/CassiniEx All Rights Reserved. 2004-04-02 By Kiliman Based on Cassini Personal Web Server, a Shared Source License project from Microsoft Corporation. See LICENSE and Microsoft EULA CassiniEx is an enhanced version of the Cassini Personal Web Server developed by Microsoft. FEATURES * Run multiple web sites and applications in a single instance of CassiniEx * Each ApplicationHost is loaded only on demand * CassiniEx loads in system tray * Supports multiple host headers and ports per web site * Supports multiple virtual folders * Each web site has a log file in W3C extended log file format * Each web site can allow or deny remote connections * Custom default documents per virtual folder * Now supports Keep-Alive connections * Support If-Modified-Since and Last-Modified headers to reduce bandwidth * Automatically unload AppDomain when Idle for user-defined time * Each virtual folder can have custom deny/allow extensions * Configuration changes are automatically loaded without having to restart the server NEW CONFIGURATION CassiniEx has a new configuation model... again! Sorry for the hassle, but I promise that it is well worth it. CassiniEx is now configured more like IIS. You can now create multiple Web Sites. Each web site can have zero or more Web Apps. Log files and Bindings are set at the Web Site level. You can now create a web site without any web applications at all. This web site will simply serve up static files. See CONFIGURATION for more detail. INSTALLATION Due to my lack of experience with VS.NET Setup projects and Windows Installer, I have returned to using a simple .Zip file for installation. Just download and unzip the Setup file. It will create the following folder structure: CassiniEx\ _SetupFiles_0.94.402\ Config.default\ Samples.default\ SampleWeb\ The files stored in _SetupFiles_0.94.402 (used to be $SetupFiles, but Visual SourceSafe won't store files with $) are only needed the first time you install. These include sample configuration files and web apps. These files are kept separate so you can unzip updated versions of CassiniEx without it overwriting any existing configuration files you may have. After you unzip the files, run the install.bat file. This will update the GAC with the latest version of the CassiniEx.dll. It will copy the default configuration and samples if they do not exist. Double-click on CassiniExWebServer.exe to start the web server. Notice that a Logs folder is automatically created when you start CassiniEx. CONFIGURATION CassiniEx no longer uses CassiniExWebServer.config. The default web settings are now stored in %ConfigPath%\_Default.website. The default web site looks like this: PATH MAP CassiniEx uses PathMaps to specify physical paths. A path map is a variable that expands to the defined path. You can use a path map variable anywhere a physical path is required. Use %variablename% as a place holder, and the path will be expanded at run-time. There are three predefined path maps: * CassiniExHome: This always maps to where CassiniExWebServer.exe is located. * ConfigPath: This is where the configuration files are located. It defaults to %CassiniExHome%\Config. You can override this by passing the config path on the command line. (e.g., CassiniExWebServer.exe -config C:\Path\To\Config) * LogPath: This is where the log files are located. It defaults to %CassiniExHome%\Logs. You can override this by passing the log path on the command line. (e.g., CassiniExWebServer.exe -log C:\Path\To\Logs) All of the Environment.SpecialFolder enumerations are also pre-definied path maps. Using these values will expand to appropriate path. (E.g, %ProgramFiles% will expand to the program files folder on your system.) WEB SITE CONFIG FILES Each web site is defined by a configuration file. These are XML files with a .website file extension. The configuration file should look like this: ELEMENT: WebSite, WebApp Attributes: * Name: The name of the web site/app. This name must be unique. It is also used as the name of the log folder (web site only). See LOGGING. * Enabled: Set this value to true to enable this web site/app. You can disable a web site/app without deleting the configuration file by setting this to false. * Bindings: This defines the host header and port mapping for the web site. Each binding is in the format of hostheader:port (e.g., localhost:80). Multiple bindings for a web site are separated by semi-colons. See BINDINGS. * CreateHostHeader: Set this value to true and an entry will be added to the HOSTS file that maps the hostname to the local IP 127.0.0.1. * VirtualPath: This defines the virtual path of the web site/app. For a web site it must always be "/". * PhysicalPath: The physical path of the web site/app. If ApplicationHost is set, the "bin" folder must be a subfolder of the physical path. You can use any PathMap variable to expand to the correct path. * ApplicationHost: Set this value to "ASP.NET" if this is an ASP.NET web application. This value is required because a WebSite and a WebApp are basically the same thing. However, the WebSite root web may not necessarily be an ASP.NET web app. In the future, there may be additional hosts that will manage PHP, Perl, and Java Servlet applications. * DefaultDocuments: (optional) Comma-delimited list of default documents. (e.g. "default.aspx,default.html") If you do not provide a value, it will get the value from the parent. If you do not want to inherit the default value, then set the value to "-". * AspNetExtensions: (optional) Comma-delimited list of extensions that will be processed by the HttpRuntime. All other extensions are treated as static files. If you do not provide a value, it will get the value from the parent. If you do not want to inherit the default value, then set the value to "-". * DenyExtensions: (optional) Comma-delimited list of extensions that will always return 404 Not Found status. This list is processed before a static file is served or a page is handed to the HttpRuntime. If you do not provide a value, it will get the value from the parent. If you do not want to inherit the default value, then set the value to "-". The extensions listed here will be ADDED to the DenyExtensions list in the Default Web. This will prevent exposing sensitive files like Web.config if you forgot to add it to the list. * AllowExtensions: (optional) Comma-delimited list of extensions that are allowed to be served to the client. If this value is not defined, then all files will be served. This list is processed AFTER the DenyExtensions and BEFORE the AspNetExtensions list. If you do not provide a value, it will get the value from the parent. If you do not want to inherit the default value, then set the value to "-". If you provide a value, you must also include any ASP.NET extensions you want to process. Either this list must be blank or include all the extensions you want to serve. * AllowBrowsing: (optional) Set this value to true if you want to send a directory listing to the client. This value defaults to false. * AllowRemoteConnections: (optional) Set this value to true if you want to allow remote connections. A remote connection is any connection that originiates from an IP address other than 127.0.0.1. See REMOTE CONNECTIONS. * IdleTime: (optional) Set the value to the number of minutes that the AppDomain may be idle before automatically being unloaded. Leave blank to inherit the value from the default web. Set to 0 to never unload. INCLUDE You can now include WebApp definitions from external files. Simply add an element in you WebSite definition. Element: Include Attributes: * Source: Name of web app config file. This file is relative to %ConfigPath% and should end with the .webapp extension. VIRTUAL FOLDERS You can define multiple virtual folders per web site/app. Create a element for each additional virtual folder needed. ELEMENT: VirtualFolder Attributes: * VirtualPath: The virtual path starting from the root. Must start with "/" and can be as many levels deep as needed. * PhysicalPath: The physical location of the virtual path. You can use any PathMap variable to expand to the correct path. * DefaultDocuments: Same as above. * AspNetExtensions: Same as above. * DenyExtensions: Same as above. * AllowExtensions: Same as above. NOTE: If your web site does not have the "aspnet_client" folder in it's physical path, then the virtual folder "/aspnet_client/system_web/1_1_4322" will be automatically mapped to the default client folder "%Windows%\Microsoft.NET\Framework\v1.1.4322\ASP.NETClientFiles". BINDINGS You don't have to create all your web sites on different ports. Just use different host headers that map to port 80. You can either manually edit the file %System%\DRIVERS\ETC\HOSTS or set CreateHostHeader = "true". The entries should look like this: 127.0.0.1 mywebsite 127.0.0.1 myotherwebsite 127.0.0.1 www.mysite.com Now in your Web Bindings, use "mywebsite:80", etc. To access the site, you can now use http://mywebsite You need to create a binding for every possible hostheader. So if your web site can be accessed by both http://domain.com and http://www.domain.com, then you have to create both bindings: Bindings = "domain.com:80;www.domain.com:80" REMOTE CONNECTIONS By default, CassiniEx only allows connection from clients on the same machine as the web server. If you want to allow remote connections, then you have to do two things. First, set AllowRemoteConnections = "true" in _Default.website. Now do the same thing in each web app you want to allow remote connections for. The reason it is needed in two places, is that the default setting controls the initial connection from the client before CassiniEx determines what web site the client is connecting to. If this value is false, then the client is disconnected immediately and an external connection attempt will be logged. If the default value is true, then CassiniEx will determine which web site was requested, and check to see if that web site allows remote connections. The request will be processed only if this value is true. If remote connections are enabled and the only host you have in Bindings is localhost, then a binding will automatically be created for the local Machine Name. Otherwise, there would be no way for external clients to connect to the web site. LOGGING CassiniEx stores it's log files in %LogPath%\Logs Each web site will get a log file in %LogPath%\ The defautlt PathMap for LogPath is %CassiniExHome%\Logs. The web log files are in W3C extended log format and include the following fields: * date * time * s-ip: Local IP * cs-method: GET, POST, etc. * cs-uri-stem: URL path * cs-uri-query: Queystring * s-port: Server Port * c-ip: Remote IP * sc-status: Status code (200, 404, etc.) * sc-bytes: Bytes out * cs-bytes: Bytes in * time-taken: Processing time in milliseconds --------------------- The default setup installs 5 configuation files. These files are located in %ConfigPath% which is defined as %CassiniExHome%\Config. Sample.website IssueTracker.webapp Infragistics.webapp VB.NETResourceKit.webapp QuickStart.webapp They are simply used to test that the server is working. I hope to replace these with real web apps soon. You can verify that the server works by trying the following URL: http://localhost I've included sample configurations for different projects. These are added to the sample web site using the element. If you want to enable them, just edit the config file and set Enabled = "true". You many need to change the PhysicalPath as well. ASP.NET Issue Tracker Starter Kit This is the ASP.NET Issue Tracker Start Kit that you can download from: http://www.asp.net/StarterKits/DownloadIssueTracker.aspx?tabindex=0&tabid=1 Infragistics Web Grid sample Download the trial version of Infragistics NetAdvantage. This configuration is for the Web Grid sample. Once you enable it, you can access the sample using the URL: http://localhost/ig_UltraWebGrid3Samples/cs/SamplesBrowser/ http://www.infragistics.com/products/netadvantage_portal.asp VB.NET Resource Kit You can download the VB.NET Resource Kit from: http://msdn.microsoft.com/vbasic/vbrkit/default.aspx .NET QuickStart Also, there is a configuration file for the Microsoft .NET Framework SDK QuickStart Tutorials. As above, just enable the web app, and modify the path if neccessary. CONCLUSION This program is still a work in progress. Please feel free to send any comments and suggestions. Thanks for trying it out. Kiliman kiliman@systemex.net 2004-04-02