Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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 tools Preview 2" (the latest VS tooling on the download site as of this writing).

Because I'm using WebListener, and because WebListener is not compatible with IIS Express, I would like to disable the "IIS Express" launch profile in Visual Studio, so that when my teammates open this solution, their Visual Studios will default to running the console app instead of IIS Express, and they'll be able to just hit Run and not get errors.

But so far, I haven't been able to rid VS of the "IIS Express" launch profile. The Project Properties > Debug tab lets me edit the list of profiles, but when I select the "IIS Express" profile, the "Delete" button is disabled. If I edit launchSettings.json directly, and delete the "IIS Express" element from under "profiles", the File > Save operation silently inserts the "IIS Express" profile back into the JSON that it saves to disk!

Apparently Microsoft really wants to always have an "IIS Express" launch profile, even though it isn't necessarily compatible with all ASP.NET Core projects. But it's worth asking: Has anyone found a way to disable the "IIS Express" launch profile in an ASP.NET Core project, and have only the self-host option(s) in the launch-profile selector?

¹ For the curious, I'm using WebListener because it will let me self-host in a Windows service and still support NTLM authentication, on a machine without IIS installed. Kestrel only supports NTLM when it's hosted in IIS, not when it's self-hosted.

like image 351
Joe White Avatar asked Feb 22 '17 03:02

Joe White


People also ask

How do you check asp net core module is installed in IIS Express?

You can check if you have the module in your IIS Express configuration file %\PROGRAMFILES(x86)%\IIS Express\config\templates\PersonalWebServer\applicationhost. config . If there is at least one of the following lines, then you have the module installed: <add name="AspNetCoreModule"...

How do I change IIS Express settings in Visual Studio?

Configure IIS express on visual studioSelect the web application project and open properties -> select the web tab -> under server's select IIS express-> Specify the project URL. Now open the project folder and . vs folder (Hidden) -> Config -> applicationhost.

How do I run .NET core Web API in IIS Express?

Press the run button on Visual Studio, it will start building the Dot Net Core Web Api project, the Api will be hosted under IIS Express and it will open a local browser with the localhost and some port will be assigned along with the default controller and action and with a Swagger UI.

How do you check IIS Express is installed or not?

IIS Express is normally installed into your 32-bit Program Files folder. So, to see if it's there you can try: C:\>cd "\Program Files (x86)\IIS Express" C:\Program Files (x86)\IIS Express>iisexpress /? Show activity on this post.


1 Answers

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.

like image 157
Ilya Luzyanin Avatar answered Oct 11 '22 01:10

Ilya Luzyanin