What are the (dis)advantages of using Cassini instead of IIS?
Asked Answered
S

28

53

I've found that on some occasions I can edit the source while debugging. Are there any other advantages of using the Visual Studio built-in webserver instead of a virtual directory in IIS?

I'm using Windows XP on my development environment, and a local instance of IIS 5. I work on several projects, so I use multiple virtual directories to manage all the different sites.

Are there any disadvantages?

Sheen answered 19/9, 2008 at 17:13 Comment(0)
L
61

The built-in web server for Visual Studio is called Cassini and here are a few of its limitations...

  • It can host only one ASP.NET application per port.
  • It does not support HTTPS.
  • It does not support authentication.
  • It responds only to localhost requests.
  • It is slow startup compared to IIS
Laurencelaurene answered 19/9, 2008 at 17:17 Comment(8)
Fixed your bulleted line breaks, and upvoted for the https and authentication remarks (separate answers would have got you two votes).Quintain
"It responds only to localhost requests" ...can't stress that enough! That makes it pretty useless for real web servingCoverage
Since its opensource, you can easily remove the localhost only limitation :). I did. Its easy.Constipate
"It responds only to localhost requests" - easy fix. Throw an additional entry in your hosts file, say "127.0.0.1 mymachine.local", and you can access it using something other than localhost. Additionally, a couple of people have set up valid domains that resolve to 127.0.0.1 - lvh.me is a good example. This has been a lifesaver for me on a couple of occasions. localhost:123/site.aspx becomes lvh.me/site.aspx. Fiddler friendly!Myogenic
@nerr you know that if you use that, no one will be able to access your site using that url except for you right?Barbosa
To clarify, Cassini does support ASP.NET Authentication(Forms), but not HTTP authentication (Basic, Digest, Windows). And "localhost" requests means "requests originating from the local machine".Irizarry
@Barbosa Yes. A disadvantage I see with Cassini is that it runs on localhost and on a strange port. I tend to use fiddler a lot and fiddler ignores localhost traffic (actually, it will if you tack on a trailing period, i.e. localhost.:9876 instead of localhost:9876, but I wasn't aware of this at the time) so instead I'd come to use the lvh.me domain OR the hosts entry.Myogenic
@Eric, Cassini itself does not provide built-in support for Basic HTTP authentication, but it does allow you to provide your own HTTP authentication if you send the right headersBarbosa
L
16

All the previous responses are great answers - here's one gottcha with Cassini that might require IIS on the destkop.

Cassini runs in the context of the developer, not as the IIS user (IUSR_, IWAM, or in WinXP x64, the w3wp process). This can be a bit painful if you've got a web site that is accessing external files or creating temp files. It is most evident when your developer is running as an Admin of their desktop.

When you move to the server IIS, something that you would have had access to in Cassini doesn't work the same. CACLing with the IIS_WPG usually is all it takes to fix, but if your developer is not thinking about this, they will quickly get quite frustrated with their deploy.

Lewanna answered 19/9, 2008 at 18:20 Comment(0)
V
10

Cassini does not support virtual directories.

Volk answered 19/9, 2008 at 18:23 Comment(0)
C
9

It looks like a third option is coming soon:

IIS Express.

Crumpet answered 3/7, 2010 at 18:16 Comment(0)
Q
5

The built-in server works well for larger corporations that don't want to give developers any administrator access on their own machines to configure IIS.

Quintain answered 19/9, 2008 at 17:15 Comment(3)
I'm sorry but why the hell would a company (any size) want to do that to a developer. That's stupid. Keep us from using native tools that every developer needs to know - in this case understanding and getting to know IIS better which is essential to and helps you be a better web developer as well as when you know IIS well, you save hours of debugging your web apps.Pegmatite
@CoffeeAddict I work at one of those companies. I can see how corporate security thinks that it is a great idea, but as a developer it really gets in my way. Fortunately, they allow exceptions for developers who are willing to go through enough hoops (I always go through those hoops).Accelerando
Restricting a developer is counterproductive.Carrasquillo
B
5

The Visual Studio web server is less forgiving about // in the path.

It will refuse to serve a link like http://localhost:52632/main//images/logo.jpg where IIS will do.

That's pretty obscure, but it means we have a lot of fixing to do to get rid of all the // occurrences.

Bernardobernarr answered 19/9, 2008 at 17:25 Comment(0)
A
5

Another disadvantage I've run into is on a Forms authenticated website using custom IPrincipal/IIdentity. Cassini will switch the AppDomains without warning (or notice).

Check this blog post for more.The headache on this made me drop Cassini and stick with IIS.

Archery answered 19/9, 2008 at 20:27 Comment(0)
U
4

There's a bug in the way the built-in server handles HTTPModules - there is a workaround, but I hate having to put in code that'll never be needed in production.

Unknowable answered 19/9, 2008 at 17:23 Comment(0)
B
3
  • You need to have Visual Studio running to use it (under normal circumstances)

  • It only responds to localhost, so you can't give the link http://simon-laptop:37473/app1 to a friend to view your site over the network

  • Big disadvantage: it's harder to get fiddler working, because localhost traffic isn't sent through the proxy.

Using http://ipv4.fiddler:37473 is the best way to get Fiddler working with it.

Bernardobernarr answered 19/9, 2008 at 17:38 Comment(2)
you can trick fiddler into watching the local traffic by adding a period before the colon and port on your url.. example localhost.:1234/MyApp Or using the fiddler passthrough ipv4.fiddler:1234Vallo
Actually, you can run it from the command line, so you don't need visual studio running.Selfacting
I
2

If you 'web reference' the URL for web services that are on the built-in webserver, the port might change. Unless you have set a "Specific port" mentioned in menu ProjectProperties options page.

This is something I've gotten used to now. I always set a specific port. Now when sometimes the webserver crashes (I've had that happen), I simply change the port number, and all is well. I reckon restarting will also fix this.

Iwo answered 19/9, 2008 at 17:18 Comment(0)
Q
2

The built-in server means the developer doesn't have to know how to set up IIS to test their site.

You could argue this is a disadvantage, and that a Windows developer should know at least that much IIS. Or you could argue that a developer who isn't a system administrator shouldn't be messing around with the web server at all.

Quintain answered 19/9, 2008 at 17:18 Comment(1)
HUGE disadvange. You should know IIS...it's critical to your job. Totally agree. That's why our profession has such dumb developers...because we rely on blackbox crap like Cassini instead of learning real code or in this case relating to real web server (IIS) which is what .NET runs on for the web. Why would you want to use anything else but IIS when that is the case. I wish MS would have never come up with this stupid side step "easy" crap like they always do...it just disservices us as professionals by making us dumber.Pegmatite
B
2

Cassini also does not support ASP Classic pages. This is only an issue for legacy projects where old ASP Classic pages still exist (like our web application at work).

Bosom answered 19/9, 2008 at 17:28 Comment(2)
who cares about classic asp...they should be converted by now.Pegmatite
@CoffeeAddict: You'd be surprised. Half the companies in San Francisco run on infrastructure apps built in the 90's that haven't been upgraded since.Nth
F
2

You cant use virtual directories :(

Frolick answered 19/9, 2008 at 21:51 Comment(0)
Q
1

If you do hobby work at home using XP Home, you can't install IIS locally.

Quintain answered 19/9, 2008 at 17:14 Comment(2)
I think the MS Web Platform Installer removes this limitation (I was able to install IIS on Vista Home)Hundredth
@Hundredth Finch Vista Home can run IIS. XP Home cannot.Quintain
Q
1

The built-in server isn't as configurable, and it runs on an odd port, so if you're counting on specific behavior it can be troublesome.

Quintain answered 19/9, 2008 at 17:16 Comment(1)
It is possible to configure the port in VS. Project->Properties->Specific portLaurencelaurene
B
1

I often take the best of both worlds and create an application in IIS, and use the built-in web server for more efficient debugging.

Bernardobernarr answered 19/9, 2008 at 17:40 Comment(0)
U
1

Cassini is meant to be a lightweight test webserver. The idea is that a developer does not need to have IIS installed and configured to test his/her application.

Use IIS if you are familiar with it and you have it set up and your box can handle it. Cassini is not meant to be a replacement.

Ungula answered 19/9, 2008 at 17:55 Comment(0)
N
1

When you use IIS in Vista or Windows 7 with UAC enabled, you must run Visual Studio with administrative rights. If you do this, you can't drag an drop from your shell to Visual Studio (even if you run an instance of explorer.exe as administrator).

For this reason I use Cassini for most projects.

Nide answered 1/7, 2009 at 16:34 Comment(1)
maybe someone should start a new question "What are the (dis)advantages of using Cassini instead of IIS on Vista/Win7?" because this is a game changer, ie on XP the best choice is IIS, but not it's not that clear of of choice on Win7Admissible
M
1

FYI, Windows XP 64-bit comes with IIS 6.

Medlar answered 6/8, 2009 at 5:48 Comment(1)
It is Windows Server 2003 in disguise.Spot
C
1

This is an old thread started 2 years ago. I just stumbled upon UtilDev Cassini while googling. Looks promising to me. At least it has the ability to run multiple sites simultaneously. That feature is really useful for me, because I work on 2 different sites and have to continuously switch between them using IIS.

Championship answered 23/7, 2010 at 13:33 Comment(1)
dude just use IIS and move on. Learn it.Pegmatite
P
1

Here's a reason for a third way: although UWS Pro is probably closer to IIS than Cassini (although inspired by Cassini and is from the vendor of the UltiDev Cassini fork), its main purpose is to be redistributable along with ASP.NET applications. enter image description here

Postglacial answered 11/7, 2011 at 21:27 Comment(1)
just use IIS, why use anything else.Pegmatite
T
0

Install IISAdmin, and you can setup separate sites in IIS 5, instead of using virtual directories.

Theresiatheresina answered 19/9, 2008 at 17:15 Comment(2)
Though only run one at a time.Medlar
that's a huge disadvantage and just not realistic - just use IIS and you can do whatever you want, have whatever running.Pegmatite
U
0

The built-in webserver is a little less robust than IIS, but requires no setup so it is just a tradeoff.

You may not always want your development projects exposed on your IIS server (even your local IIS server) so the built-in server is good for that.

However, if your application is going to access resources outside of the norm for a web app then you may want to debug frequently in IIS so that your app will run with restricted permissions and you can see where the pain points will be.

Uninterested answered 19/9, 2008 at 17:20 Comment(0)
I
0

We've also seen some issues with Visual Studio built-in server regarding some third-party controls which put their scripts in the \aspnet_client folder.

Since the folder isn't there when you're not running under IIS, the controls didn't work. It seems a lot simpler to always work with IIS and avoid strange problems.

Improvised answered 19/9, 2008 at 18:9 Comment(0)
P
0

One difference I've found is that the development server handles uploading files differently than IIS does. You can't trap the error if the file being uploaded is bigger than your Max_File_Size setting. The page just dies and returns a 500.

Prober answered 19/9, 2008 at 18:57 Comment(0)
T
0

Another dis-advantage is that it sends every request through the gloabal asax file which includes all requests for images and stylesheets. This means if you have code in there which does things with the file names, such as a look up, then the auxillary files willget processed too.

Tulle answered 6/8, 2009 at 5:32 Comment(0)
P
0

Also via IIS, you don't have to worry about automatically remembering and setting a stupid port number in your localhost url. That's something funky directly relied upon with Cassini...big pain in the ass. Who wants to remember some abritrary port number. Just run the damn site in IIS..plain and simple.

Pegmatite answered 9/1, 2012 at 8:50 Comment(0)
V
-1

If your project resides in the IIS directory you can still edit code. It just depends if it has been published or not.

You will run into so many issues on the Cassini vs. IIS when you are debugging certain permission based scenarios, like Kerberos and NTLM authentication as well as issues like server compression, etc. All in all, the Cassini is still okay to develop with, but make sure you do extensive testing when publishing to IIS.

Vallo answered 19/9, 2008 at 17:17 Comment(1)
why test later when you can be testing all along in IIS, what's really going to be running your code for all ASP.NET anyway? just so you can save 2 seconds every time you want to debug? Not a good tradeoff...you save more hassle and learn more in the end by using IIS period.Pegmatite

© 2022 - 2024 — McMap. All rights reserved.