简体   繁体   中英

ASP.NET Core publishing to IIS Blank Loading Screen

I have published asp.net core 1.0 application to IIS version 8.5 as a new website. I can only able to see the login page. After the successful login, getting the blank page. perhaps routing is not working perfectly.I don't have any issues running this app on my Dev machine.see my config and startup

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
    {
        loggerFactory.AddConsole(Configuration.GetSection("Logging"));
        loggerFactory.AddDebug();

        app.UseApplicationInsightsRequestTelemetry();
        app.UseSession();
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
            app.UseBrowserLink();
        }
        else
        {
            app.UseExceptionHandler("/Home/Error");
        }

        app.UseApplicationInsightsExceptionTelemetry();

        app.UseStaticFiles();
        app.UseMvc(routes =>
        {
            routes.MapRoute(
                name: "default",
                template: "{controller=Login}/{action=Login}/{id?}");
        });
    }

<system.webServer>
<handlers>
  <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>

Login Controller

public class LoginController : Controller
{
    private StaunchContext _context;
    public LoginController(StaunchContext context)
    {
        _context = context;
    }

    // GET: /<controller>/
    public IActionResult Login()
    {
        return View();
    }

    [HttpPost]
    public async Task<IActionResult> Login(UserDetails users)
    {
        if (ModelState.IsValid)
        {
            var exist =await _context.UserDetails.SingleOrDefaultAsync(x => x.Email == users.Email && x.Password == users.Password);
            if ((exist!=null)&& exist.Id > 0)
            {
                TempData["Users"] = JsonConvert.SerializeObject(exist);
                HttpContext.Session.SetString("Email", exist.Email);
                return RedirectToActionPermanent("Index", "Search");
            }
            else
            {
                ModelState.AddModelError("loginerror", "Invalid username or password");
            }
        }
        return View(users);
    }

I believe your default route is the login page. If you change it, does that fix the problem?

app.UseMvc(routes =>
{
    routes.MapRoute(
        name: "default",
        template: "{controller=Home}/{action=Get}/{id?}");
});

(make sure to replace Home & Get with your default page)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM