小编Q.R*_*Rey的帖子

发布.net核心应用程序“未配置启动”时出错

自从两天以来,当我在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)

c# asp.net-core

5
推荐指数
1
解决办法
540
查看次数

标签 统计

asp.net-core ×1

c# ×1