Upgrade MVC 2 to MVC 3 issues with views

泪湿孤枕 提交于 2019-12-05 14:37:05

This is a bug in MVC 3 Preview 1, and will be addressed in the next release. In the interim, you can rearrange your pages so that the <%@ Control %> directive is the last one in the file and that should the issue for you.

I simply replaced the web.config in my 'Views' folder (with one from a newly created mvc3 project) as the migration suggested and it worked for me. I wasn't prepared to move all the declarations to the bottom as my project was just too big.

Hope it helps although this is probably too late for you. Maybe it helps others...

On the off chance try changing your bindingRedirect to

<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />

I had the exact same problem and after pulling my hair out a bit, found and followed Wiaan's solution. Worked perfectly, and the site is back up.

Funny enough not making this change on our dev boxes did not break our site - it was only when we moved it to a staging server that it surfaced.

If your project is based on MVC4 or using Framwork 4 already, create mvc4 empty project. And then replace web.config in views folder. It works immediately. Thanks, Wianne. Since I have kind of old app that used aspx rather than razor. After I upgraded Framework 3 to 4, I got this error.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!