c# - ASP.NET Core publishing to IIS Blank Loading Screen -
i have published asp.net core 1.0 application iis version 8.5 new website. can able see login page. after successful login, getting blank page. perhaps routing not working perfectly.i don't have issues running app on dev machine.see config , 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 default route login page. if change it, fix problem?
app.usemvc(routes => { routes.maproute( name: "default", template: "{controller=home}/{action=get}/{id?}"); });
(make sure replace home & default page)
Comments
Post a Comment