自从两天以来,当我在IIS上发布.net核心应用程序时发生了错误。我的角度部分工作正常,但.net核心部分未加载。
在我的startup.cs中:
`public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddCors();
services.AddDbContext<HistoriqueContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("HistoriqueContext"),b=>b.UseRowNumberForPaging()));
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseCors(builder => builder
.WithOrigins("http://localhost:4200")
.AllowAnyMethod()
.AllowAnyHeader()
.AllowCredentials());
app.UseAuthentication(); …Run Code Online (Sandbox Code Playgroud)