How can I disable the IIS Express launch profile for ASP.NET Core?

前端 未结 5 1052
梦如初夏
梦如初夏 2020-12-30 00:49

I\'m writing an ASP.NET Core app (on the full .NET Framework) that uses WebListener, rather than Kestrel.¹ I\'m using Visual Studio 2015 with Update 3, and \".NET Core 1.0.1

相关标签:
5条回答
  • 2020-12-30 01:24

    UPDATE:

    The issue should be fixed with the latest release (update) of Visual Studio 2017.

    Initial answer:

    As mentioned in comments in ssmith answer, Visual Studio keeps restoring the settings on restart.

    Since I could not find a better solution, I just denied the write permissions on launchsettings.json for Visual Studio. I left the instructions in my other answer for similar question, here is just a copy&paste:

    1. Update your launchsettings.json for the last time.
    2. Close Visual Studio.
    3. Open security settings (right-click on launchsettings.json in Explorer -> Properties -> Security)
    4. Click Advanced -> Change Permissions
    5. Select "Authenticated Users" (or other user group under which Visual Studio is running on your machine) from the "Permissions entries" list and click Edit ->
    6. Check Deny for "Create files / write data" permission.
    7. Click OK in all open dialogs and warnings to save changes.
    8. Reopen Visual Studio and see it fail to do it's update.

    Hope it helps.

    0 讨论(0)
  • 2020-12-30 01:25

    The following worked for me:

    1. Open the project properties
    2. In the Debug tab, select the IIS profile, and click Delete
    3. In the Launch combo, select Project
    4. Open the project file (Edit the project file)
    5. Add the following as the first entry in the <PropertyGroup>

      <OutputType>Exe</OutputType>

    0 讨论(0)
  • 2020-12-30 01:46

    Is it sufficient for you to simply delete the IIS Express option from the launchSettings.json file under Project properties?

    Delete the stuff in the red box:

    Now only the other profile should appear:

    Note that I'm using VS2017 RC. It may be a bug in VS2015 that you're encountering. You might try editing and saving the launchSettings.json file with a separate text editor and see if that works for you. I can confirm this works fine in VS2017 RC, though.

    0 讨论(0)
  • 2020-12-30 01:46

    So we've been struggling with this as well. What we ended up doing was having a copy of the launchsettings.json which was "clean", without the IIS Express stuff in it, and then having a pre build script which copies the clean version on top of the existing version.

    1. Create a new file. launchSettings.json.pristine in the same folder as your existing launch settings file.

    2. Add a pre build script to copy the clean file overwritting the IIS settings.

      cd ..\..\..\Properties copy launchSettings.json.pristine launchSettings.json

    This should effectively copy it over on build/run/etc.

    0 讨论(0)
  • 2020-12-30 01:48

    I've created VS 2017 extension to deal with iis express launch settings https://marketplace.visualstudio.com/vsgallery/e09e0342-f9af-4306-8cf5-35238e34592d

    The overall idea is to fix launchSettings.json for each .net core project before executing Build/Start/StartWithoutDebugging commands

    0 讨论(0)
提交回复
热议问题