Error in ASP.MVC "Can not find resource"

1

I'm starting in ASP.NET and tried to create a test app.

When running through Visual Studio I get the error of print.

I created a standard MVC 5 project, created the controller model and view each in its proper location.

EDIT

AsIwouldthenaccesstheprojectstructureaccordingtotheimagebelow:

    
asked by anonymous 05.05.2017 / 21:18

3 answers

2

IIS does not serve the .cshtml files of your application. You access the pages of your application by entering the routes mapped to it. You will see how to configure these routes at some point in your learning, but for now just know that by default they are created like this:

nome do 'controller' (sem o sufixo "controller")/nome do método no controller

Note that to serve HTML, you must have a view with the same method name.

So, if you have a controller called "fooController" and a view called index , what you are looking for is in:

/foo/index
    
05.05.2017 / 21:23
1

You never access the View file directly.

Correct is to access the Action of each Controller . For example, if I have a Controller named ProdutosController and an Action named Index , the route will be:

http://localhost:53710/Produtos/Index

There are also standard routes. They are usually defined in the RouteConfig.cs file, App_Start directory.

A zero-configured project is set to HomeController as Controller and Index as Action . You can change it if you like.

EDIT

Since you only have one Controller created, you can access it using:

http://localhost:53710/Categorias

Or

http://localhost:53710/Categorias/Index
    
05.05.2017 / 21:23
1

You are trying to access something that is not accessible, the view code.

Note that in the Views folder there is a web.config file, it is responsible for blocking this.

  

HomeController

Given the posted image, you must access (if there is an action Index in controller )

http://localhost:53710/Categorias/Index
    
05.05.2017 / 21:23