Ich verwende VS 2015 Update3. Ich habe web api ASP.NET Kern mit dem folgenden Code Program.csVerwendet VS 2015 Kestrel?
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();
}
}
dann in VS I IIS Express konfiguriert haben auf Port 40000
Dies wird ausgeführt, wie launchSettings.json wie
sieht{
"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"
}
}
}
}
Dann drücke ich F5, um App mit Visual Studio zu starten. Wenn ich eine Anfrage an API mache, bekomme ich das Ergebnis zurück, also funktioniert alles gut.
In Program.cs habe ich .UseIISIntegration()
. So war ich unter Eindruck, wenn Anfrage zu IIS express kommt, leitet sie diese Anfrage nur an Kestrel weiter. Also ich dachte, IIS Express und Kestrel muss gleichzeitig auf 2 verschiedenen Ports laufen.
Allerdings, als ich lief netstat -ab
Befehl Ich bemerkte, IIS Express läuft auf Port 40000 wie erwartet, aber nichts läuft auf Port 5000
. In der Tat, nur um zu testen, änderte ich IIS Express-Port auch auf 5000
und es hat gut funktioniert. Ich habe einen Konflikt zwischen IIS Express und Kestrel erwartet, aber das ist nicht passiert.
Also Frage ist, verwendet VS 2015 Kestrel überhaupt?