开发者

run Cassini from console

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


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜