Migrating ASP.NET (MVC 2) on .NET 3.5 over to .NET 4 #gotchas

无人久伴 提交于 2019-12-04 17:51:30
Charlino

Gotcha #1 - Changes application pool

If your ASP.NET project is setup to use IIS and not Cassini, during the upgrade to .NET 4.0 process it'll automatically change the application pool that your site uses to the new ASP.NET v4.0 application pool. This may have an effect on permissions if you are using the application pool identity for anonymous authentication.

Gotcha #2 - [ValidateInput(false)] stops working

This is a breaking change in ASP.NET 4.0. A related question can be found here.

The jist is that you must add <httpRuntime requestValidationMode="2.0" /> into your web.config.

I just went through that process. It was relatively painless. It'll give you a chance to do some house cleaning with your web.config files, as you mentioned.

There's one area I had trouble with. If you're taking advantage of the post build ASP.NET compile task in the project file via MvcBuildViews = true, you may experience a problem if you then attempt a publish. Apparently VS 2010 stages files within your project's subdirectory, resulting in the ASP.NET compiler detecting multiple web.config files. There's a full explanation and a response by Microsoft on this post:

http://forums.asp.net/p/1547458/3797505.aspx

Otherwise the process was pretty smooth.

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