Visual Studio 2017 15.4
,IIS Express
,CORE 2.0 MVC
,Win 7 Ultimate
我用Core 2.0创建了一个新的MVC项目。没有SSL,运行正常:
LaunchSettings.json
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:58087/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"MVCIdenWebApp": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:58088/"
}
}
}
当我将其设置为使用SSL时,我收到Vis Stud错误:
Unable to connect to web server IISExpress
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "https://localhost:58087/",
"sslPort": 44335
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"MVCIdenWebApp": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:58088/"
}
}
}
Program.cs的
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build();
}
使用SSL与CORE 1.1项目没有问题,但在任何CORE 2.0项目中都会出现相同的错误。
我已经尝试删除解决方案的.vs folder
和MyDocmuents\IIExpress
文件夹的内容。
部分解决方案:
当我使用sslPort向IIS Express配置文件添加“launchUrl”时,应用程序将在该地址(而不是applicationURL)打开:“launchUrl”:“https://localhost:44335”,
这与CORE 1.1不同,我不知道这是否是official
方法,因为我无法找到有关如何在Core 2.0应用程序中启用SSL的任何文档。
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "https://localhost:58087/",
"sslPort": 44335
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "https://localhost:44335/",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"MVCIdenWebApp": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:58088/"
}
}
}
答案 0 :(得分:0)
我有&#34;无法连接到网络服务器IISExpress&#34;使用类似的设置配置。
修复我的方法是通过提升的cmd提示删除urlacl。
netsh http show urlacl
netsh http delete urlacl https://machine:iisexpressport/