简体   繁体   English

如何使IIS Express在解决方案中运行所有网站?

[英]How to make IIS Express run all websites in a solution?

When using IIS Express to debug web applications in Visual Studio, VS will run all the solution's web applications in IIS Express upon your pressing F5 to debug. 当使用IIS Express在Visual Studio中调试Web应用程序时,按F5进行调试时,VS将在IIS Express中运行解决方案的所有Web应用程序。 However, when you stop debugging, it will actually stop running the "Startup project" website meaning that if you then try to visit it in the browser you will just get a "connection closed". 但是,当您停止调试时,它将实际上停止运行“启动项目”网站,这意味着,如果您随后尝试在浏览器中访问它,则只会得到“连接已关闭”。

The only way I've found to get around this behaviour and keep the website running outside of debug mode is if you right-click an aspx or html file and select "View in browser" - this makes VS run all web applications in IIS Express. 我发现解决此问题并保持网站在调试模式之外运行的唯一方法是,右键单击aspxhtml文件并选择“在浏览器中查看”-这使VS在IIS Express中运行所有Web应用程序。 However it requires you to have such a file in your web application, which you might well not if your application is MVC. 但是,这需要您在Web应用程序中拥有这样的文件,如果您的应用程序是MVC,则可能不需要。

So is there a way to explicitly tell VS to just run all the web applications in IIS Express, allowing you to view them in the browser even when Visual Studio isn't in debug mode, without using the "right-click View in browser" trick? 因此,有一种方法可以明确告诉VS仅在IIS Express中运行所有Web应用程序,即使在Visual Studio不在调试模式下,您也可以在浏览器中查看它们,而无需使用“在浏览器中右键单击视图”特技?

When you click on stop debugging, VS will kill the issexpress.exe process on which the debugger is attached. 当您单击停止调试时,VS将终止附加了调试器的issexpress.exe进程。

An alternate way is to go to the Debug Menu and Select 'Detach Debugger', which detaches the debugger without killing the issexpress.exe process allowing your websites to still be visible. 另一种方法是转到“调试”菜单,然后选择“分离调试器”,它可以在不终止issexpress.exe进程的情况下分离调试器,从而使您的网站仍然可见。

Under debug you have the option to "start without debugging" (i believe the default shortcut is CTRL+F5) which starts the website but does not start a debugging session. 在调试下,您可以选择“不调试就启动”(我相信默认快捷方式是CTRL + F5),它将启动网站,但不启动调试会话。

Keep in mind that if you close VS (or ISSExpress) the application will still stop and any changes in compiled code will require a rebuild. 请记住,如果关闭VS(或ISSExpress),该应用程序仍将停止,并且已编译代码中的任何更改都将需要重新生成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM