从控制台运行卡西尼号
我使用 MsBuild.exe 从控制台调试我的项目。编译项目后,我想启动并测试它,但我有问题,无法启动 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用以下格式调用它:
以下信息来自我的机器,用于默认位置安装,YMMY。
对于2.0 - 3.5/VS 2008,它位于:
并且它只是
WebDev.WebServer.exe
对于4.0/VS 2010,它移至10.0目录,它位于:
对于不同的 CLR 版本,有一个
WebDev.WebServer20
和WebDev.WebServer40
。You can call it with this format:
The below info is from my machine for a default location install, YMMY.
For 2.0 - 3.5/VS 2008, it's at:
And it's just
WebDev.WebServer.exe
For 4.0/VS 2010 it moved to the 10.0 directory, it's at:
And there's a
WebDev.WebServer20
andWebDev.WebServer40
for the different CLR versions.从命令行启动 WebDev.WebServer 的问题是,您不知道您请求的端口是否已在使用中,在这种情况下,将显示一个令人讨厌的模式对话框,并且没有可靠的方法将其关闭当你完成时。
您可以可靠地托管 WebDev.WebHost,它是 WebDev.WebServer 的核心,并且通过一些辅助方法,可以确保您获得开放端口并且可以可靠地将其关闭。
请参阅本页上的第二个示例: http://www .codeproject.com/KB/aspnet/test-with-vs-devserver-2.aspx
而且,正如您所知,CassiniDev 提供了一些扩展功能。
Fixture
类可以让您完全控制服务器。但除非您确实需要使用环回以外的 IP,否则自托管 WebDev.WebHost 可能是您的最佳选择。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.