August 30, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

Deciding on a Microsoft Web Server: Cassini, IIS, and IIS Express

  • April 18, 2011
  • By David Talbot
  • Send Email »
  • More Articles »

Microsoft recently introduced IIS 7.5 Express to give developers the full feature set of IIS including HTTPS support with the convenience of Cassini. IIS Express 7.5 and Visual Studio 2010 Service Pack 1 Beta can both be downloaded and tested out at your leasure while we discuss the merits of each web server.

Cassini: Visual Studio's Default Web Server

Cassini is the default web server included in Visual Studio that launches when you press F5 or the play icon within Visual Studio. It provides the convenience of being able to set a break point in your code--simply press F5 and when your breakpoint is hit, Visual Studio’s debugger will dutifully stop on the indicated line. This is very convenient for building and debugging simple web pages but it isn’t without its limitations.

You might have noticed that Cassini is very slow to load images, scripts and other resources. This is because Cassini lacks the full multi-threading magic of real IIS. On a more positive note, this can help keep you keenly aware of the number of resources used by your web page so you’ll know what the experience of using your page will be like when someone is accessing it over a slower connection.

Cassini does not support HTTPS. Websites behave differently over HTTPS. If you accidently do certain things like loading an iframe with no default url initially or access a bad image, it can result in the user’s browser declaring that your site is insecure. If you are integrating with 3rd party websites to do various things, there are some approaches that work over HTTPS and other approaches will not work over HTTPS. For example, cross-frame access of 3rd party websites won’t work.

If you get too far along in your web development cycle before identifying and addressing these issues, then your project can come to a fiery end when it comes time to deploy to your production web server.

Casinni is enabled by default, but to configure it for your project, right click your web project’s root node in the solution explorer and choose properties. In the dialog that appears choose “Use Visual Studio Web Server”.

The Real Internet Information Server (IIS)

You can configure your application from the very beginning to run in IIS. The advantage of this is that if you intend to eventually deploy on a real IIS web server, you've got a head start. Starting out here makes a lot of sense to ensure that you’re not building anything into your application that will become a problem when you try to do a real production deployment.

Going directly to IIS, however, is not without its challenges from a development standpoint. First, if you’re running an older version of Windows, you can’t run IIS 7.5. The versions of production IIS available are operating system constrained and you don’t always have the option to just upgrade your operating system. Second, many corporate enviroments won’t let you run the full version of IIS on your development machine due to security concerns related to common internet worms.

Although real IIS allows you to use HTTPS, it’s a fairly complicated process to get it up and working even if you do configure a dummy self-signed certificate.

To use real IIS, right click on the root of your web project and choose properties. In the properties dialog, choose “Use Local IIS Web Server”. If your application isn’t located in your wwwroot, you will also need to click “Create Virtual Directory”. Visual Studio will have configured your application folder and placed it in an appropriate app pool. Under this configuration, your application is configured and will be accessible from a browser even if Visual Studio isn’t running.

To debug it, you can either hit F5 or you can go to Debug->Attach to Process and find the w3wp.exe process on your machine.

IIS Express: A Development Web Server

IIS 7.5 Express allows you run IIS on your development machine even if you’re not running Windows 7, and it integrates beautifully into Visual Studio 2010 SP1. After you’ve installed Visual Studio 2010 SP1 and IIS 7.5 Express, you can right click the root node of your web project in the solution explorer and choose “Use IIS Express”.  Once you’ve selected this option, a checkbox will appear in the project properties allowing you to enable/disable IIS Express under the “Use IIS” option.

Once configured, IIS Express works exactly like Cassini but only with the full feature set of IIS. When you hit F5 or the play icon, your application will compile and IIS Express will start with the debugger attached.

You don’t have to configure a virtual directory at all for your application to run in IIS 7.5 Express. When you launch the debugger, it will launch and when you stop the debugger it will close and go away.

Even though IIS Express doesn’t need a virtual directory, it can use the full configuration defined in your web.config file including additional configured extensions. This means any IIS modules and extensions you might need configured will work as though it is being run inside of real IIS.

IIS 7.5 Express includes a self-signed certificate to enable HTTPS right out of the box with no additional configuration needed. This means you can start running your application over HTTPS without any special work. After you’ve launched your application, click on the IIS Express icon that will appear in your task tray. You’ll see two entries along with the port numbers they are running on, one for http and one for https. To access your application over https, simply change your URL to https and use the port number the IIS Express configuration tool lists as your https port number.

To enable HTTPS on your IIS Express site for your project, with the properties window open, left click the root node of your web site and set “Use HTTPS” to true.

Conclusion

IIS 7.5 Express offers the best of both worlds. The convenience of Cassini with the full power of IIS. It adds to the mix automatic pre-configured HTTPS providing a clear improvement in development options.


Tags: Microsoft, web servers, IIS Express, Microsoft IIS, Cassini

Originally published on http://www.developer.com.


Comment and Contribute

 


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

 

 


Sitemap | Contact Us

Rocket Fuel