Click here to Skip to main content
15,886,857 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I am new in .net core. I just start coding for payroll system in small scale.

If i run in localhost/payroll. Nothing appear.

Pls advice me

Maideen

What I have tried:

startup.cs
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
       {
           if (env.IsDevelopment())
           {
               app.UseDeveloperExceptionPage();
           }
           else
           {
               app.UseExceptionHandler("/DashBoard/Error");
               app.UseHsts();
           }
           //app.UseDefaultFiles();
           app.UseHttpsRedirection();
           app.UseStaticFiles();
           app.UseCookiePolicy();

           app.UseMvc(routes =>
           {
               routes.MapRoute(
                   name: "default",
                   template: "{controller=DashBoard}/{action=Index}/{id?}");
           });
       }
Posted
Comments
GKP1992 22-Feb-19 0:17am    
What HTTP response do you get in the browser?
Maideen Abdul Kader 22-Feb-19 1:57am    
thank you for prompt reply.

I have tried chrome just normal : localhost/payroll
Nothing happened.

I have tried http://localhost/payroll
result : This site can’t be reached. localhost refused to connect.

pls advice me.
Thank you

maideen
MadMyche 22-Feb-19 7:12am    
You have provided the configuration code. How about the controller and the view?
Maideen Abdul Kader 22-Feb-19 23:29pm    
hiIf i use iis express vs2017, it will work, http://localhost:10417/. Only in localhost/payroll is not displayed any thing

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using PayRoll.Models;

namespace PayRoll.Controllers
{
public class HomeController : Controller
{
public IActionResult Index()
{
return View();
}

public IActionResult Privacy()
{
return View();
}

[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
}

Pls advice me.

Thank you
Ram Nunna 1-Mar-19 1:49am    
It seems like your controller name is Home. Below sample code may help you.
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{Id?}"
);
});

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900