Prevent iisexpress from running the websites in a solution when the startup app is a console app

∥☆過路亽.° 提交于 2019-11-29 16:02:22

问题


I have a solution with a number of projects in it. Even if I set the web project's start options to:

  1. Don't open a page. Wait for a request from an external application.
  2. Use custom webserver. Base URL: http://localhost.

And the startup project to:

  1. Single startup project
  2. Select the console application (not website)

When I press start debugging, IIS express launches (shows up on the taskbar). How do I prevent from IIS Express from launching? I am only running a console application, and don't want IIS Express running.

In fact, all of the websites in the solution launch in IIS, and they consume resources on my machine unnecessarily.


回答1:


There's easy way to do this: in web project's properties F4 (NOT right click-> properties) set "always start when debugging" to false




回答2:


In the Property Pages-> Start Options: Set Start Action = "Don't open a page..."; Set Server -> Use custom server and leave Base URL blank.




回答3:


For Visual Studio 2013, I configured it like this:

Start Action: Don't open a page.

Servers: External Host

Project Url: http://NotAStartupApp/




回答4:


I uninstalled IIS Express in windows and it worked for me. After publishing my files from VS, automatically my settings changed to point to IIS Express and it wont change to IIS, no matter what, for my Website project. Hope this works for someone.




回答5:


To extend @Aleksey L.'s answer, you can actually do this with a plain text editor like Notepad.

In your projectname.csproj.user file, make sure your the AlwaysStartWebServerOnDebug node has a value set to False.

projectname.csproj.user

<Project >  
  <ProjectExtensions>
    <VisualStudio>
      <FlavorProperties>
        <WebProjectProperties>
            ..          
          <AlwaysStartWebServerOnDebug>False</AlwaysStartWebServerOnDebug>
            ..          
        </WebProjectProperties>
      </FlavorProperties>
    </VisualStudio>
  </ProjectExtensions>
</Project>

Alternatively, to do this without a text editor you can use Powershell

$file = 'projectname.csproj.user'
$x = [xml] (Get-Content $file)
$x.Project.ProjectExtensions.VisualStudio.FlavorProperties.WebProjectProperties.AlwaysStartWebServerOnDebug = 'False'
$x.Save($file)


来源:https://stackoverflow.com/questions/24330919/prevent-iisexpress-from-running-the-websites-in-a-solution-when-the-startup-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!