Closed MateusKernDigibyte closed 3 years ago
I fixed it by putting services.AddWkhtmltopdf();
after services.AddMvc();
, e ficou assim:
public void ConfigureServices(IServiceCollection services)
{
services.Configure<CookiePolicyOptions>(options =>
{
options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None;
});
services.AddDbContext<ApplicationDbContext>(options => options.UseLazyLoadingProxies().UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
services.AddIdentity<IdentityUser, IdentityRole>(options =>
{
options.Password.RequireNonAlphanumeric = false;
options.Password.RequireUppercase = false;
options.Password.RequiredLength = 6;
options.User.RequireUniqueEmail = true;
})
.AddDefaultUI()
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders();
services.AddMvc();
services.AddWkhtmltopdf();
}
I put services.AddWkhtmltopdf(); in the ConfigureServices method in Startup.cs in my .NET Core project using Razor and I got this error when trying to access the login page:
InvalidOperationException: Session has not been configured for this application or request.
This one is my Startup class:
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.UI.Services; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using System; using System.Threading.Tasks; using Wkhtmltopdf.NetCore;
namespace Digibyte.Controle { public class Startup { public IConfiguration Configuration { get; }
}
When I comment out the
services.AddWkhtmltopdf();
no more mistakesCan anyone help me with this error?