开发者

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

I've currently got a ASP.NET MVC 2 application on .NET 3.5 and I want to migrate it over to the new .NET 4.0 with Visual Studio 2010.

Reason being that it's always good to stay on top of these things - plus I really like the开发者_开发问答 new automatic encoding with <%: %> and clean web.config :-)

So, does anyone have any experience they could share? Looking for gotchas and the likes.

I guess this could also apply to any ASP.NET Forms projects aswell.

TIA,

Charles


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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜