Asp.net 核心 2.2 app.UseHttpsRedirection() 未定义
Asp.net Core 2.2 app.UseHttpsRedirection() is not defined
当我尝试使用 app.UseHttpsRedirection() 方法时,它给我一个构建错误:
'IApplicationBuilder' does not contain a definition for 'UseHttpsRedirection' and no accessible extension method 'UseHttpsRedirection' accepting a first argument of type 'IApplicationBuilder' could be found (are you missing a using directive or an assembly reference?
我已经尝试安装 Microsoft.AspNetCore.HttpsPolicy nuget 包。
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
app.UseAbp(); // Initializes ABP framework.
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Error");
}
app.UseStaticFiles();
app.UseHttpsRedirection();
app.UseAuthentication();
app.UseCookiePolicy();
app.UseHttpMethodOverride
app.UseJwtTokenMiddleware();
app.UseSignalR(routes =>
{
routes.MapHub<AbpCommonHub>("/signalr");
});
app.UseMvc(routes =>
{
routes.MapRoute(
name: "defaultWithArea",
template: "{area}/{controller=Home}/{action=Index}/{id?}");
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
UseHttpsRedirection 是隐藏在
Microsoft.AspNetCore.HttpsPolicy
动态链接库。您必须添加它(通过 NuGet 或手动)
有关您可能需要的更多 DLL,请参阅 accepted answer here
当我尝试使用 app.UseHttpsRedirection() 方法时,它给我一个构建错误:
'IApplicationBuilder' does not contain a definition for 'UseHttpsRedirection' and no accessible extension method 'UseHttpsRedirection' accepting a first argument of type 'IApplicationBuilder' could be found (are you missing a using directive or an assembly reference?
我已经尝试安装 Microsoft.AspNetCore.HttpsPolicy nuget 包。
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
app.UseAbp(); // Initializes ABP framework.
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Error");
}
app.UseStaticFiles();
app.UseHttpsRedirection();
app.UseAuthentication();
app.UseCookiePolicy();
app.UseHttpMethodOverride
app.UseJwtTokenMiddleware();
app.UseSignalR(routes =>
{
routes.MapHub<AbpCommonHub>("/signalr");
});
app.UseMvc(routes =>
{
routes.MapRoute(
name: "defaultWithArea",
template: "{area}/{controller=Home}/{action=Index}/{id?}");
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
UseHttpsRedirection 是隐藏在
Microsoft.AspNetCore.HttpsPolicy
动态链接库。您必须添加它(通过 NuGet 或手动)
有关您可能需要的更多 DLL,请参阅 accepted answer here