开发者

ASP.Net MVC Web App not running

开发者 https://www.devze.com 2023-01-01 11:19 出处:网络
I developed an ASP.Net MVC v1 web application and it ran fine on our server. The client wanted to move to another server, and the site does not run on the new host\'s server.

I developed an ASP.Net MVC v1 web application and it ran fine on our server. The client wanted to move to another server, and the site does not run on the new host's server.

The new server specs:

  • Windows 2008
  • ASP.Net Framework v4
  • ASP.Net MVC 2 (afaik its included with .Net v4)
  • IIS 7.5 (afaik)

Error Message:

Could not load file or assembly 'System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

My understanding is that it should be backwards compatible.开发者_运维百科 Is the app really trying to run in ASP.Net MVC v1 when v2 is available?

I have already tried deploying the MVC .dlls to the Bin folder, but it did not work.

I also tried changing all the system.Web.Mvc Version values (in the web.config for the web app) from 1.0.0.0 to 2.0.0.0, which also did not work.

Any assistance will be greatly appreciated.


I think the best thing to do would be to install MVC 1.0 on your server -- it's separate from MVC 2.0. You could also migrate your code to 2.0, but there are a few steps that need to be done and there have been some breaking changes between the two versions. In particular, the IValueProvider interface has changed significantly and, if you've used this, you may be in for some significant modifications. Versions 1.0 and 2.0 are compatible, in the sense that they can both be installed on the same system and that most constructs in 1.0 continue to work in 2.0. You do, however, have to complete a few steps to migrate a 1.0 web site to a 2.0 web site (as you are finding out).


I agree with tvanfosson, I would install MVC 1.0 on your server. If for some reason this is not possible then add the following to your web.config file:

<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
      <assemblyIdentity name="System.Web.Mvc"
                        publicKeyToken="31bf3856ad364e35"/>
      <bindingRedirect oldVersion="1.0.0.0"
                       newVersion="2.0.0.0"/>
    </dependentAssembly>
  </assemblyBinding>
</runtime>

This will ensure that anything trying to reference MVC 1.0 assemblies will be redirected to MVC 2.0 instead.

Personally, I wouldn't expect everything just to work and would be doing this in a development environment first as part of a full upgrade to MVC 2.0.

0

精彩评论

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

关注公众号