I am using VS 2015 Update3. I have ASP.NET core web api with the following Program.cs code
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseUrls("http://*:5000")
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
Then in VS I have configured IIS Express to run on port 40000
This is how launchSettings.json looks like
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:40000/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "api/workunit",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Api": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "http://localhost:5000/api/values",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
Then I press F5 to run app using Visual Studio. When i make a request to API i get the result back so everything works fine.
In Program.cs I have .UseIISIntegration()
. So I was under impression when request comes to IIS express, it just forwards that request to Kestrel.
So I thought both IIS Express and Kestrel has to run at the same time on 2 different ports.
However when I ran netstat -ab
command I noticed IIS express is running on port 40000 as expected but nothing is running on port 5000
. In-fact just to test I changed IIS Express port also to 5000
and it worked fine. I was expecting conflict between IIS Express and Kestrel, but that didn't happen.
So question is does VS 2015 uses Kestrel at all?