开发者

Problems deploying MVC2 - Could not load type 'System.Web.Mvc.UrlParameter'

开发者 https://www.devze.com 2022-12-24 00:04 出处:网络
I have problems deploying MVC2 application to my hosting. It shows the following error: Could not load type \'System.Web.Mvc.UrlParameter\' from assembly \'System.Web.Mvc, Version=2.0.0.0, Culture=ne

I have problems deploying MVC2 application to my hosting. It shows the following error:

Could not load type 'System.Web.Mvc.UrlParameter' from assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

It looks like it does not understand the new "optional URL parameters" feature of MVC2. This is just a simple test application I created with "New Project" wizard in VWD 2008. It works ok localy both in IIS and Visual Studio web servers. MVC1 web sites are working ok on the hosting server. I've contacted the hosting support and they installed MVC2 but the problem still exists. The web site is working in ASP.NET 2.0 integr开发者_C百科ated pipeline mode.

Does anyone know why it is happening?


What ya gotta do is copy the MVC dll locally. In visual studio's solution explorer do this: Click the Show All Files button

Problems deploying MVC2 - Could not load type 'System.Web.Mvc.UrlParameter'

The drop down the references section and select the System.Web.Mvc reference

Problems deploying MVC2 - Could not load type 'System.Web.Mvc.UrlParameter'

Then in the properties window change Copy Local to true.

Problems deploying MVC2 - Could not load type 'System.Web.Mvc.UrlParameter'


You should remove MVC2 RC then download and install MVC2 RC2.


FIXED:

Change id = UrlParameter.Optional to id = "" in Global.asax.

This change at least gets the site to render.


I also have this problem when deploying my MVC2 app to my hosts. Has anybody come up with a cause for this.

Changing the UrlParameter.Optional to a fixed value changes the behaviour of the app, so, I'm a little bit unhappy doing this.

Courtesy of Phil Haack (I'd love to take credit) but try bin deploying the System.Web.Mvc assembly by going to the properties of the reference to System.Web.Mvc and change Copy Local to true.

Dead impressed that Phil invested the time and energy to help on this.


My application threw this exception when it couldn't find a dll file.

I use Microsoft.Web.Mvc.AspNet4.dll from ASP.NET MVC 2 Futures. I had the dll file on my workstation, but hadn't deployed it onto my web server.


I got the error but I'm using MVC2 with .NET Framework 3.5 and that Class is targeted to .NET Framework 4.0.

I by mistake downloaded and assembly targeting .NET Framework 4.0 :(

0

精彩评论

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

关注公众号