简体   繁体   中英

Starting an MVC4 basic template project

I'm trying to start a new MVC4 C# project using the basic template, when I debug the project I get the "The resource cannot be found" error, how would I fix this so I just shows a blank page I can work on?

Thanks in advance.

You need to add Controllers and View pages to just show something!

Add HomeController : Controller file

public string Index()
{
return "Hello";
}

if you run now, you will be able to see hello on the page

The "Basic" template does not have any controllers or views in it. You have to create at least a HomeController and an associated view for a page to be displayed. If you want an example application to start from that has something to view without adding anything choose the "Internet Application" template. It creates a default HomeController and and Index view as well as account logon pages.

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