We've had some trouble using the latest ASP.NET MVC Preview 5. For reasons unknown any attempt to open a view (e.g. Default.aspx, not the code-behind) in Visual Studio 2008 would cause a fatal .NET runtime error and the Visual Studio process would simply be killed. Dead. Gone.
Annoying.
I spent a good amount of time trying to figure out why this could be, and though there were a few leads on the web none of the proposed solutions out there fixed the problem. So, I asked the senior developer on my team, Steve Friend, to have a look. Sic' em, Steve!
Steve noticed that Scott Guthrie's Preview 5 Example Application wouldn't cause any problems at all. Nor would any MVC project added to the same solution as Guthrie's application. However, all other MVC projects created from scratch with Visual Studio would suffer from the symptom described at the top of this post.
Steve examined the differences between ScottGu's application and a 'fresh' MVC app, and discovered that removing two of the DLLs from the fresh MVC app's /bin folder solved the problem. He documented this on our internal wiki, and I've copied-and-pasted his fix here. Thanks Steve!
-------------
Creating a new project
In Visual Studio create a new MVC project (File > New > Project, then select Visual C# > Web then select ASP.Net MVC Web Application). This will create a fairly large default project containing a number of folders and files relating to the MVC pattern structure (i.e. models, views and controllers).
Once you have done this you will need to build the project and create a new website in IIS (see IISSetup for details of how to do this), but before you do that, run through the instructions below to avoid the bug that seems to ship with default projects.
The bug
If you double click on any view page (i.e. a aspx page) in order to edit it in Visual Studio the application crashes.
The fix
In the solution explorer select "Show all files" to reveal the bin folder. In there you will the following dlls (and possibly more, if you have already built your project/solution):
* Microsoft.Web.Mvc.dll
* System.Web.Abstractions.dll
* System.Web.Mvc.dll
* System.Web.Routing.dll
Delete "System.Web.Abstractions.dll" and "System.Web.Routing.dll".
http://www.babel-lutefisk.net/2008/09/fix-for-aspnet-mvc-preview-5-bug-with.html
这个问题弄了两天,就是用preview的代价吧,preview是不是就是以前的CTP?