Add no-https option for all templates (dotnet/aspnetcore#413)
Addresses dotnet/aspnetcore#322 Commit migrated from dotnet/aspnetcore@cb7942abe4
This commit is contained in:
Родитель
f85e9ca96f
Коммит
95fa23da3c
|
@ -19,7 +19,7 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetFrameworkOverride)' != ''">
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="${MicrosoftAspNetCorePackageVersion}" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.HttpsPolicy" Version="${MicrosoftAspNetCoreHttpsPolicyPackageVersion}" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.HttpsPolicy" Version="${MicrosoftAspNetCoreHttpsPolicyPackageVersion}" Condition="'$(NoHttps)' != 'True'"/>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="${MicrosoftAspNetCoreMvcPackageVersion}" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SpaServices" Version="${MicrosoftAspNetCoreSpaServicesPackageVersion}" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="${MicrosoftAspNetCoreSpaServicesExtensionsPackageVersion}" />
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetFrameworkOverride)' != ''">
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="${MicrosoftAspNetCorePackageVersion}" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.HttpsPolicy" Version="${MicrosoftAspNetCoreHttpsPolicyPackageVersion}" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.HttpsPolicy" Version="${MicrosoftAspNetCoreHttpsPolicyPackageVersion}" Condition="'$(NoHttps)' != 'True'"/>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="${MicrosoftAspNetCoreMvcPackageVersion}" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SpaServices" Version="${MicrosoftAspNetCoreSpaServicesPackageVersion}" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="${MicrosoftAspNetCoreSpaServicesExtensionsPackageVersion}" />
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetFrameworkOverride)' != ''">
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="${MicrosoftAspNetCorePackageVersion}" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.HttpsPolicy" Version="${MicrosoftAspNetCoreHttpsPolicyPackageVersion}" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.HttpsPolicy" Version="${MicrosoftAspNetCoreHttpsPolicyPackageVersion}" Condition="'$(NoHttps)' != 'True'"/>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="${MicrosoftAspNetCoreMvcPackageVersion}" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SpaServices" Version="${MicrosoftAspNetCoreSpaServicesPackageVersion}" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="${MicrosoftAspNetCoreSpaServicesExtensionsPackageVersion}" />
|
||||
|
|
|
@ -22,6 +22,10 @@
|
|||
"ExcludeLaunchSettings": {
|
||||
"longName": "exclude-launch-settings",
|
||||
"shortName": ""
|
||||
},
|
||||
"NoHttps": {
|
||||
"longName": "no-https",
|
||||
"shortName": ""
|
||||
}
|
||||
}
|
||||
}
|
|
@ -67,7 +67,7 @@
|
|||
"HttpsPort": {
|
||||
"type": "parameter",
|
||||
"datatype": "integer",
|
||||
"description": "Port number to use for the HTTPS endpoint in launchSettings.json."
|
||||
"description": "Port number to use for the HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used (no-https will be ignored if either IndividualAuth or OrganizationalAuth is used)."
|
||||
},
|
||||
"HttpsPortGenerated": {
|
||||
"type": "generated",
|
||||
|
@ -115,6 +115,12 @@
|
|||
"datatype": "bool",
|
||||
"description": "If specified, skips the automatic restore of the project on create.",
|
||||
"defaultValue": "false"
|
||||
},
|
||||
"NoHttps": {
|
||||
"type": "parameter",
|
||||
"datatype": "bool",
|
||||
"defaultValue": "false",
|
||||
"description": "Whether to turn off HTTPS. This option only applies if IndividualAuth or OrganizationalAuth are not being used."
|
||||
}
|
||||
},
|
||||
"tags": {
|
||||
|
|
|
@ -27,5 +27,6 @@
|
|||
}
|
||||
],
|
||||
"excludeLaunchSettings": false,
|
||||
"minFullFrameworkVersion": "4.6.1"
|
||||
"minFullFrameworkVersion": "4.6.1",
|
||||
"disableHttpsSymbol": "NoHttps"
|
||||
}
|
|
@ -18,7 +18,11 @@
|
|||
"Company.WebApplication1": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
//#if(NoHttps)
|
||||
"applicationUrl": "http://localhost:5000",
|
||||
//#else
|
||||
"applicationUrl": "https://localhost:5001;http://localhost:5000",
|
||||
//#endif
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
#if (!NoHttps)
|
||||
using Microsoft.AspNetCore.HttpsPolicy;
|
||||
#endif
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.SpaServices.AngularCli;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
@ -38,10 +41,15 @@ namespace Company.WebApplication1
|
|||
else
|
||||
{
|
||||
app.UseExceptionHandler("/Home/Error");
|
||||
#if (!NoHttps)
|
||||
app.UseHsts();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
#else
|
||||
}
|
||||
|
||||
#endif
|
||||
app.UseStaticFiles();
|
||||
app.UseSpaStaticFiles();
|
||||
|
||||
|
|
|
@ -22,6 +22,10 @@
|
|||
"ExcludeLaunchSettings": {
|
||||
"longName": "exclude-launch-settings",
|
||||
"shortName": ""
|
||||
},
|
||||
"NoHttps": {
|
||||
"longName": "no-https",
|
||||
"shortName": ""
|
||||
}
|
||||
}
|
||||
}
|
|
@ -67,7 +67,7 @@
|
|||
"HttpsPort": {
|
||||
"type": "parameter",
|
||||
"datatype": "integer",
|
||||
"description": "Port number to use for the HTTPS endpoint in launchSettings.json."
|
||||
"description": "Port number to use for the HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used (no-https will be ignored if either IndividualAuth or OrganizationalAuth is used)."
|
||||
},
|
||||
"HttpsPortGenerated": {
|
||||
"type": "generated",
|
||||
|
@ -115,6 +115,12 @@
|
|||
"datatype": "bool",
|
||||
"description": "If specified, skips the automatic restore of the project on create.",
|
||||
"defaultValue": "false"
|
||||
},
|
||||
"NoHttps": {
|
||||
"type": "parameter",
|
||||
"datatype": "bool",
|
||||
"defaultValue": "false",
|
||||
"description": "Whether to turn off HTTPS. This option only applies if IndividualAuth or OrganizationalAuth are not being used."
|
||||
}
|
||||
},
|
||||
"tags": {
|
||||
|
|
|
@ -27,5 +27,6 @@
|
|||
}
|
||||
],
|
||||
"excludeLaunchSettings": false,
|
||||
"minFullFrameworkVersion": "4.6.1"
|
||||
"minFullFrameworkVersion": "4.6.1",
|
||||
"disableHttpsSymbol": "NoHttps"
|
||||
}
|
|
@ -18,7 +18,11 @@
|
|||
"Company.WebApplication1": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
//#if(NoHttps)
|
||||
"applicationUrl": "http://localhost:5000",
|
||||
//#else
|
||||
"applicationUrl": "https://localhost:5001;http://localhost:5000",
|
||||
//#endif
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
#if (!NoHttps)
|
||||
using Microsoft.AspNetCore.HttpsPolicy;
|
||||
#endif
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.SpaServices.ReactDevelopmentServer;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
@ -39,10 +41,15 @@ namespace Company.WebApplication1
|
|||
else
|
||||
{
|
||||
app.UseExceptionHandler("/Home/Error");
|
||||
#if (!NoHttps)
|
||||
app.UseHsts();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
#else
|
||||
}
|
||||
|
||||
#endif
|
||||
app.UseStaticFiles();
|
||||
app.UseSpaStaticFiles();
|
||||
|
||||
|
|
|
@ -22,6 +22,10 @@
|
|||
"skipRestore": {
|
||||
"longName": "no-restore",
|
||||
"shortName": ""
|
||||
},
|
||||
"NoHttps": {
|
||||
"longName": "no-https",
|
||||
"shortName": ""
|
||||
}
|
||||
}
|
||||
}
|
|
@ -67,7 +67,7 @@
|
|||
"HttpsPort": {
|
||||
"type": "parameter",
|
||||
"datatype": "integer",
|
||||
"description": "Port number to use for the HTTPS endpoint in launchSettings.json."
|
||||
"description": "Port number to use for the HTTPS endpoint in launchSettings.json. This option is only applicable when the parameter no-https is not used (no-https will be ignored if either IndividualAuth or OrganizationalAuth is used)."
|
||||
},
|
||||
"HttpsPortGenerated": {
|
||||
"type": "generated",
|
||||
|
@ -115,6 +115,12 @@
|
|||
"datatype": "bool",
|
||||
"description": "If specified, skips the automatic restore of the project on create.",
|
||||
"defaultValue": "false"
|
||||
},
|
||||
"NoHttps": {
|
||||
"type": "parameter",
|
||||
"datatype": "bool",
|
||||
"defaultValue": "false",
|
||||
"description": "Whether to turn off HTTPS. This option only applies if IndividualAuth or OrganizationalAuth are not being used."
|
||||
}
|
||||
},
|
||||
"tags": {
|
||||
|
|
|
@ -27,5 +27,6 @@
|
|||
}
|
||||
],
|
||||
"excludeLaunchSettings": false,
|
||||
"minFullFrameworkVersion": "4.6.1"
|
||||
"minFullFrameworkVersion": "4.6.1",
|
||||
"disableHttpsSymbol": "NoHttps"
|
||||
}
|
|
@ -18,7 +18,11 @@
|
|||
"Company.WebApplication1": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
//#if(NoHttps)
|
||||
"applicationUrl": "http://localhost:5000",
|
||||
//#else
|
||||
"applicationUrl": "https://localhost:5001;http://localhost:5000",
|
||||
//#endif
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
#if (!NoHttps)
|
||||
using Microsoft.AspNetCore.HttpsPolicy;
|
||||
#endif
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.SpaServices.ReactDevelopmentServer;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
@ -39,10 +41,15 @@ namespace Company.WebApplication1
|
|||
else
|
||||
{
|
||||
app.UseExceptionHandler("/Home/Error");
|
||||
#if (!NoHttps)
|
||||
app.UseHsts();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
#else
|
||||
}
|
||||
|
||||
#endif
|
||||
app.UseStaticFiles();
|
||||
app.UseSpaStaticFiles();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче