關(guān)于使用ASP.NET CORE 3.1 點(diǎn)擊無(wú)反應(yīng)的 點(diǎn)進(jìn)來(lái)看一下?。?!
有問(wèn)題的可以對(duì)照一下我的Starup.cs文件 主要是在endpoints里加一個(gè)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();
? ? ? ? ? ? ? ??
? ? ? ? ? ? });
? ? ? ? }
? ? }
}
2020-09-03
全部都復(fù)制過(guò)去了 還是沒(méi)用啊?