run Cassini from console
Asked Answered
E

2

8

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?

Ecclesiastical answered 15/5, 2010 at 7:31 Comment(1)
I just released the CassiniDev 3.5.1/4.0.1 beta with a simple test fixture example if you are interested.Laurustinus
P
10

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.

Pillory answered 15/5, 2010 at 7:37 Comment(3)
huh that was fast. Thx i will test it.Ecclesiastical
@Ecclesiastical - I'll update the answer with the 2k8 location, forgot that one woops.Pillory
Nick, for future reference, take a look at the article linked in my answer.Laurustinus
L
5

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.

Laurustinus answered 16/5, 2010 at 4:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.