Browse DevX
Sign up for e-mail newsletters from DevX


Explore and Extend the Cassini Web Server : Page 3

Extend the power of Cassini, Microsoft's source-available Web server based on the .NET Framework, to provide a lightweight HTTP server for your applications.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

Debugging Cassini
The Cassini source and build script uses the command line C# compiler. As distributed it does not support using Visual Studio .NET solutions and projects to build and debug the code. The best option for debugging Cassini is to use the Attach Process feature in Visual Studio .NET. 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.

Randy Holloway is the founder of Winformation Systems, a technology consulting and training initiative specializing in the development of enterprise systems in the Windows environment and Web services technologies. Randy speaks on technology-related topics and writes for publications including DevX.com and Visual Studio Magazine. Contact Randy .
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date