Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

run Cassini from console

Tags:

c#

cassini

I debug my project from console with MsBuild.exe. After i compile project i want to start and test it, but i have problem that i can not start Cassini for testing project. Can i run Cassini from console?

like image 666
senzacionale Avatar asked May 15 '10 07:05

senzacionale


2 Answers

You can call it with this format:

WebDev.WebServer /port:9999 /path:"C:\Projects\Web Site"

The below info is from my machine for a default location install, YMMY.


For 2.0 - 3.5/VS 2008, it's at:

C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\9.0

And it's just WebDev.WebServer.exe


For 4.0/VS 2010 it moved to the 10.0 directory, it's at:

C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\10.0

And there's a WebDev.WebServer20 and WebDev.WebServer40 for the different CLR versions.

like image 148
Nick Craver Avatar answered Oct 24 '22 03:10

Nick Craver


The problem with starting WebDev.WebServer from the command line is that you do not know if the port you are asking for is already in use, in which case a nasty modal dialog will be shown, and there is no reliable way to shut it down when you are finished.

You can reliably host WebDev.WebHost, which is the core of WebDev.WebServer, and with a few helper methods, can ensure you get an open port and you can reliably shut it down.

See the second example on this page: http://www.codeproject.com/KB/aspnet/test-with-vs-devserver-2.aspx

And, as you already know, CassiniDev offers some extended capabilities. The Fixture class can give you full control of the server. But unless you actually need to use an IP other than loopback, self hosting WebDev.WebHost is probably your best bet.

like image 43
Sky Sanders Avatar answered Oct 24 '22 01:10

Sky Sanders