开发者

Why ASP.NET MVC templates are available only for Web Application projects?

开发者 https://www.devze.com 2022-12-27 13:21 出处:网络
What is the reason that ASP.NET MVC templates are available only for Web Application projects and not for Web Site proj开发者_StackOverflowects? Web Site projects work by giving you the option of lett

What is the reason that ASP.NET MVC templates are available only for Web Application projects and not for Web Site proj开发者_StackOverflowects?


Web Site projects work by giving you the option of letting your pages be compiled on the fly. That means that your code in the code-behind (or in the page) for those pages isn't compiled until a request is made to view the page. The only reason that works is because your page and the code-behind for it are tied together.

In an ASP.NET MVC Project, a user doesn't request a page. They enter a URL and the URL Routing directs the request to the appropriate Controller for handling. Since Views and Controllers aren't implicitly linked like ASPX and Code-Behind files, they need to be pre-compiled.

Therefore, the Web Application is the only option that will work for ASP.NET MVC.


ASP.NET MVC relies on the compilation (i.e. you compile before deploying) model of WAP.

(Web Site projects are compiled in deployment by default.)

0

精彩评论

暂无评论...
验证码 换一张
取 消