Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/302.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# ASP.NET核心发布到IIS空白加载屏幕_C#_Asp.net_Asp.net Core - Fatal编程技术网

C# ASP.NET核心发布到IIS空白加载屏幕

C# ASP.NET核心发布到IIS空白加载屏幕,c#,asp.net,asp.net-core,C#,Asp.net,Asp.net Core,我已将asp.net core 1.0应用程序作为新网站发布到IIS 8.5版。 我只能看到登录页面。登录成功后,获取空白页面。可能路由工作不完美。在我的开发机器上运行此应用程序没有任何问题。请参阅我的配置和启动 public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Co

我已将asp.net core 1.0应用程序作为新网站发布到IIS 8.5版。 我只能看到登录页面。登录成功后,获取空白页面。可能路由工作不完美。在我的开发机器上运行此应用程序没有任何问题。请参阅我的配置和启动

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"/>
public void配置(IApplicationBuilder应用程序、IHostingEnvironment环境、iLogger工厂)
{
loggerFactory.AddConsole(Configuration.GetSection(“Logging”);
loggerFactory.AddDebug();
app.UseApplicationInsightsRequestTelemetry();
app.UseSession();
if(env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseBrowserLink();
}
其他的
{
app.UseExceptionHandler(“/Home/Error”);
}
app.UseApplicationInsightsExceptionTelemetry();
app.UseStaticFiles();
app.UseMvc(路由=>
{
routes.MapRoute(
名称:“默认”,
模板:“{controller=Login}/{action=Login}/{id?}”);
});
}

登录控制器

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);
    }
公共类登录控制器:控制器
{
私人坚定语境(private StaunchContext);;
公共登录控制器(StaunchContext上下文)
{
_上下文=上下文;
}
//获取://
公共IActionResult登录()
{
返回视图();
}
[HttpPost]
公共异步任务登录(用户详细信息用户)
{
if(ModelState.IsValid)
{
var exist=wait_context.UserDetails.SingleOrDefaultAsync(x=>x.Email==users.Email&&x.Password==users.Password);
如果((exist!=null)&&exist.Id>0)
{
TempData[“Users”]=JsonConvert.SerializeObject(存在);
HttpContext.Session.SetString(“Email”,exist.Email);
返回重定向到操作永久(“索引”、“搜索”);
}
其他的
{
AddModelError(“登录错误”,“无效的用户名或密码”);
}
}
返回视图(用户);
}

我相信您的默认路径是登录页面。如果您更改它,是否解决了问题

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

(请确保将Home&Get替换为默认页面)

这对我没有帮助。我的控制器是“LoginController”,操作是“Login”,但应用程序主页的控制器是什么?成功登录返回RedirectToActionPermanent(“索引”、“搜索”)时会发生这种情况;主页SearchController和操作是索引成功登录后,您是否在URL中看到正确的路径?如果是,我猜问题更可能是SearchController及其视图的问题,而不是登录的问题。不,即使成功登录后,它也会显示登录URL。浏览器中是否存在网络错误开发工具?(按F12->网络选项卡)您可以为SearchController添加代码吗?您是否正在检查用户是否已在SearchController中通过身份验证?因为Login post方法中没有任何内容表明用户已通过身份验证。是的,Petre的评论是正确的。从浏览器的开发人员控制台向我们显示您的网络或JavaScript错误