开发者

mvc 2 using Codebehind instead of precompiled dll

开发者 https://www.devze.com 2023-02-09 23:11 出处:网络
How do I run my mvc 2 web application using the code-behind classes rather than the generated dll it creates when compiling ?

How do I run my mvc 2 web application using the code-behind classes rather than the generated dll it creates when compiling ?

The reason for this is so I can update an Action in a controller for example via the .cs file rather than having to redeploy a 开发者_StackOverflow社区new dll for the whole site.

Similar to how you could have websites in asp.net 2 webforms rather than web applications


ASP.NET MVC uses ASP.NET application instead of ASP.NET website so what you are asking is not possible. The application needs to be precompiled before deployment.

Now this being said you could in fact you a web site as model for ASP.NET MVC application but be prepared to do everything manually.

  1. Create a new ASP.NET website
  2. In the special App_Code folder add a controller
  3. Add the Views folder containing the corresponding web.config, layout and views
  4. Configure your routes in Global.asax

So you need to put all your code behind (controllers, models, ...) in the special App_Code folder.

0

精彩评论

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