Hi, we are using Kestrel without IIS to host our web app. We also want to use Kestrel for local development/debugging.
However, with RC2-Preview1, Visual Studio always automatically adds a web.config and the IIS-Express profiles to launchsettings.json and it always starts IIS Express when I hit F5.
Can this be disabled?
I found out that you have to set the project as the "Startup project" in order to be able to switch between the IIS Express and the Kestrel profile. If it's not the startup project, the "Debug -> Start Debugging" button only shows "Start" as a text. Would be good if this was made more visible.
However I still can't delete the IIS-Express profile.
TFS: 223023
I've added this to our internal TFS, we will reply back here soon.
@sayedihashimi, any update on this? :)
We would really like to have our launchSettings.json
to be more focused and look like:
{
"profiles": {
"Staging Profile": {
"commandName": "Project",
"commandLineArgs": "--port=3012",
"launchBrowser": true,
"launchUrl": "http://localhost:3012",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Staging"
}
},
"Production Profile": {
"commandName": "Project",
"commandLineArgs": "--port=3012",
"launchBrowser": true,
"launchUrl": "http://localhost:3012",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Production"
}
}
}
}
instead of the tool automatically adding iisSettings
and profiles:IIS Express
:
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:23045/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Staging Profile": {
"commandName": "Project",
"commandLineArgs": "--port=3012",
"launchBrowser": true,
"launchUrl": "http://localhost:3012",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Staging"
}
},
"Production Profile": {
"commandName": "Project",
"commandLineArgs": "--port=3012",
"launchBrowser": true,
"launchUrl": "http://localhost:3012",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Production"
}
}
}
}
We cannot even change the default order, for example; launching VS with a clean solution or after git clean
, we always get default selection as IIS Express. Reordering profiles in launchSettings.json
doesn't help either for IIS Express profile. However, VS profile selector abides by the ordering for all other profiles.
If opting out of IIS specific settings is not on the near future roadmap, can we at least have default profile option for VS in upcoming RTM?
PS we literally have a note for devs to change the profile selection after git clean
..
This still occurs in Visual Studio 2017 now that it has been released.
This annoys me all the time, because I have no value in the IIS profile, no matter how you delete it if you reopen the solution it will just get re-created.
This is not a solution, but an ugly workaround. I figured that if I would just deny permissions to change the launchsettings.json file this will prevent Visual Studio from overwriting it every time. Since this file doesn't change much, it is more or less a satisfying solution for me.
So:
Hope it helps. At least until it won't be fixed for real.
Please fix this +1
Sorry for all the issues here. We are working on some updates in this area. We are planning on making the following changes.
launchSettings.json
if it already existslaunchSettings.json
if missinglaunchSettings.json
all togetherFYI we already fixed the issue where web.config
was created.
After these changes I think these scenarios will be significantly improved.
I think that these will fix some of the issue. The other piece of this that I don't think these changes fix is when you have a launchsettings.json with both IIS and the Project setup as options for the launch setting.
Steps:
Open the properties open in visual studio
Deselect IIS Express and select the project as the default
Visual studio will not allow you to save your change of selection.
If you close it will not prompt you and will not persist that change.
If it did let you save it, where would it go?
Is it valid for a launchsettings.json file to have both options? If it is there should be some say of setting one as a default. In the json below how is it ever going to be "profiles" if the only setting that is honored is the IIS Express one?
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:21904/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Web": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "http://localhost:5010",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:5010"
}
}
}
The _workaround_ from @iluzyanin doesn't fit for me: When I try to permit writing, the dialog automatically disallow reading, too. So VS couldn't read the file any more, which gave me an exception. Seems like something to do with inherits. Its sad that the IIS annoys users who dont need and want them, and this bug exists for about a year now! I have the file in VCS to gave all my team members the same configuration. This would result me in having the wrong configuration selected, and I've to reset the file, so that the wrong version didn't get in VCS...
@sayedihashimi Will the fix be part of the next (15.3 I guess) VS update?
This is also affecting a large project I'm working on. Please fix ASAP. Thanks!
This is still an issue.
Still an issue ...
I'm not even doing anything requiring a server, just a class library with a single interface for net461. And still it adds this:
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:51351/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"loremipsum": {
"commandName": "Project"
}
}
}
Edit csproj and add this:
<ItemGroup>
<Content Remove="properties/launchsettings.json" />
</ItemGroup>
I'm not even doing anything requiring a server, just a class library with a single interface for net461. And still it adds this:
What SDK are you using? The Web SDK?
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputType>Library</OutputType>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
<RuntimeIdentifier>win7-x86</RuntimeIdentifier>
<OutputTypeEx>library</OutputTypeEx>
<Authors>Björn Ali Göransson</Authors>
<Company />
<Description>Installs (...) on your project.</Description>
<Copyright>Björn Ali Göransson</Copyright>
<PackageLicenseUrl>https://www.gnu.org/licenses/gpl-3.0.en.html</PackageLicenseUrl>
<AssemblyVersion>1.0.8.0</AssemblyVersion>
<Version>1.0.8.0</Version>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<BuildOutputTargetFolder>lib\net461</BuildOutputTargetFolder>
</PropertyGroup>
<ItemGroup>
<Content Remove="Properties\launchSettings.json" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\launchSettings.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="(...).Core" Version="1.0.5" />
<PackageReference Include="(...).Admin" Version="1.0.10" />
<PackageReference Include="(...).JsonStore.FileBased" Version="1.0.3" />
</ItemGroup>
</Project>
The two first ItemGroup
I added to prevent it getting packaged. But the problem existed before, of course.
I started from scratch with this project, it's actually completely empty, I'm only using it for adding the deps in a simple way.
That's the Web SDK. If you wanted a regular class library then you made the wrong kind of application. What options did you choose that lead you to a web project?
Oh fair enough. Didn't know about the sdk part.
I had been fiddling around but could not get vs to create the new kind of
slim csproj for class libraries, so I just tried to change it by hand...
Den 5 jul 2017 05:24 skrev "David Fowler" notifications@github.com:
That's the Web SDK. If you wanted a regular class library then you made
the wrong kind of application. What options did you choose that lead you to
a web project?—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/aspnet/Tooling/issues/486#issuecomment-312987603, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAoyAFSSxE1IDXv5Wb3RoOyVsX7wuLNUks5sKwIDgaJpZM4IgE0g
.
So if it's a console project that runs a web server, does it need to be Microsoft.NET.Sdk
or Microsoft.NET.Sdk.Web
? I thought the latter?
Web projects are - Microsoft.NET.Sdk.Web
Console projects are - Microsoft.NET.Sdk
Class libraries are - Microsoft.NET.Sdk
Web projects make assumptions about a couple of things:
wwwroot
as the static file folder and publishes that content to the outputWell, one of these class libraries actually have views that will be
packaged into a TAR, used by a custom IFileProvider to leverage Views to
Mvc ... but I digress. Understand that a Web project needs to set a port
number.
On 5 July 2017 at 17:01, David Fowler notifications@github.com wrote:
Web projects are - Microsoft.NET.Sdk.Web
Console projects are - Microsoft.NET.Sdk
Class libraries are - Microsoft.NET.SdkWeb projects make assumptions about a couple of things:
- It assumes you'll want IIS/IIS Express (you can just switch the
profile if you don't want to launch that way)- It turns on Server GC by default
- It has excludes for client side package managers (node_modules,
jspm, bower components)- It understands wwwroot as the static file folder and publishes that
content to the output- It turns on a bunch of other web project system capabilities in the
IDE like the Razor editor experience and other things that I won't go
into...—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/aspnet/Tooling/issues/486#issuecomment-313129725, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAoyACA4PJu_GmwNnAC9HW9fRqm3CEynks5sK6U9gaJpZM4IgE0g
.
Please reconsider the priority on this - it's becoming increasingly frustrating to deal with when opening any solutions in Visual Studio and having these IIS entries added, changing the running environment and also being accidentally checked into source control.
@manigandham are you checking in this file after manually deleting the IIS configuration?
@manigandham as a workaround, when it adds it in, move it to the end of the profiles list and commit that. It will still be in the profiles list but at least it won't be the default selection when you open the solution.
@davidfowl Yes, the file is checked in without the IIS configs, this is all we have:
{
"profiles": {
"ndweb": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost/"
}
}
}
@jjcole tried that (moved the IIS Express
profile to end) but VS 2017 Enterprise still launches IIS Express:
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:55138/",
"sslPort": 0
}
},
"profiles": {
"ndweb": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost/"
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
I am really annoyed by this bug. I made those files readonly, which gives me popups, but still better than having to undo the changes on an hourly basis. hope it gets fixed soon.
the profile that Visual Studio generates is not working in my case, since I wrote self-hosted services and depend on the proper port numbers. VS makes IIS host everything on the wrong port and with a false configuration.
This issue looks like it has been resolved in Visual Studio 2017 version 15.3.0. Very much appreciated. Thanks!
Turns out there's a setting you can add to the csproj to disable the default launch profile:
<NoDefaultLaunchSettingsFile>True</NoDefaultLaunchSettingsFile>
This was driving me nuts. Thanks for the setting key @davidfowl 👍
Most helpful comment
Sorry for all the issues here. We are working on some updates in this area. We are planning on making the following changes.
launchSettings.json
if it already existslaunchSettings.json
if missinglaunchSettings.json
all togetherFYI we already fixed the issue where
web.config
was created.After these changes I think these scenarios will be significantly improved.