To debug your changes, first run the modified build script for the Cassini assemblies, which will create the executable application and the type library. Then run the CassiniWebServer.exe application. After it's running, open up Visual Studio .NET and select
Debug Processes from the Tools menu. You'll see the Processes dialog shown in
Figure 1. Select the CassiniWebServer.exe process, and then click the
Attach button. Doing that adds the process to the list view in the lower portion of the window, and enables the
Break,
Detach, and
Terminate buttons on the dialog. When you click the Break button, the debugger breaks into the selected process, letting you see the code that is currently being executed. From there you can set breakpoints in the code and inspect variables.
 | |
| Figure 1: Visual Studio .NET enables you to easily attach to a process and debug it directly. When debugging .NET applications that have debug symbols supported through .pdb files, the debugging will enable you to view the source code for the application if it is available. |
Note that with Cassini, the easiest way to debug the Web server is to set a breakpoint in the main executable and then step into the code for the Cassini.Server instance. For the example in this article you'll want to set a breakpoint in the
Host.cs file on the private method
OnSocketAccept(), since that's where you implemented the extended functionality for request logging.
As the sample application demonstrates, you can easily extend and modify Cassini to suit your individual needs. The ability to see and modify the source makes it a great platform for learning about ASP.NET and the development of internet application servers in general. In addition, Cassini's extensibility makes it an ideal choice for hosting your local client ASP.NET applications or for developing and testing ASP.NET applications.