为了账号安全,请及时绑定邮箱和手机立即绑定

关于使用ASP.NET CORE 3.1 点击无反应的 点进来看一下!!!

有问题的可以对照一下我的Starup.cs文件 主要是在endpoints里加一个MapRazorPages();

using System;

using System.Collections.Generic;

using System.Linq;

using System.Threading.Tasks;

using Microsoft.AspNetCore.Builder;

using Microsoft.AspNetCore.Hosting;

using Microsoft.AspNetCore.Http;

using Microsoft.Extensions.DependencyInjection;

using Microsoft.Extensions.Hosting;

using LanzhouBeefNoodles.Models;

using Microsoft.EntityFrameworkCore;

using Microsoft.Extensions.Configuration;

using Microsoft.AspNetCore.Identity;


namespace LanzhouBeefNoodles

{

    public class Startup

    {

        // This method gets called by the runtime. Use this method to add services to the container.

        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940

        public IConfiguration Configuration { get; }

        public Startup(IConfiguration configuration)

        {

            Configuration = configuration;

        }

        public void ConfigureServices(IServiceCollection services)

        {

            services.AddDbContext<AppDbContext>(options =>

                options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))

                );

            services.AddMvc();

            services.AddRazorPages();

            services.AddTransient<INoodleRepository, NoodleRepository>();

            services.AddTransient<IFeedbackRepository, FeedbackRepository>();

        }


        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.

        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)

        {

            if (env.IsDevelopment())

            {

                app.UseDeveloperExceptionPage();

                

            }

            app.UseHttpsRedirection();

            app.UseStaticFiles();       

            app.UseRouting();

            app.UseAuthentication();

            app.UseEndpoints(endpoints =>

            {

                endpoints.MapDefaultControllerRoute();

                endpoints.MapRazorPages();

                

            });

        }

    }

}


正在回答

2 回答

全部都复制过去了 还是没用啊?


0 回复 有任何疑惑可以回复我~

???谢谢,我也正在计划把课程迁移至3.1。

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

关于使用ASP.NET CORE 3.1 点击无反应的 点进来看一下!!!

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信