1

We have a C# .NET website which was developed and maintained by a third party. I'm due to take over the general upkeep soon, so am trying to get a system going where I can maintain a local copy and deploy updates to the website. We need to make it work for two of us to work on for at least another month, after that I'm on my own.

We have an SVN of source, and an SVN of production published code. I can pull the solution and after some faffing I can make it build and run without problems locally. I'm using Visual Studio 2015, the target framework is 4.0.

I can update cshtml files, build, publish locally, and then copy these files over the website published version and it runs fine.

However, the bin/dlls that are produced, if copied into the website version, produces this fabulous error:

http://website.com/Error/InternalServerError?aspxerrorpath=/
Server Error in '/' Application. Runtime Error. 
Description: An exception occurred while processing your request. 
Additionally, another exception occurred while executing the custom error page for the first exception. 
The request has been terminated.

If I copy back the dlls from the original, it works fine.

If I don't modify the code, but just build and publish the project, my dlls are still different sizes from the website versions.

The developers are using Visual Studio 2012, is this a factor? Why are the dlls for my local version (that runs fine) different, if I download the source and build/publish it with no changes?

The dlls in question by the way are a single one for the website itself, website.dll say, and one for 'objects' that they've dumped a load of functions into for doing various things, objects.dll, these are the only two I'm trying to copy over - all the other dlls match in size between my and the website versions.

I'm pretty new to this so may be making some fundamental mistakes here, but if I am, then our developer isn't picking up on them. I mean, I'm kind of not surprised that they're different, surely you need to deploy the whole project, and not just drop some dlls into an existing published folder? My developer is saying that's the only way we can do it...

Any tips of things I can try?

Thanks in advance.

Ralpharama
  • 441
  • 4
  • 20
  • 1
    Take a look at the Windows Event Viewer - your actual exception may have been logged there. – Joe Enos Apr 28 '16 at 16:00
  • Ooh, there IS something: Could not load file or assembly 'System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=99999' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) at Objects.RouteConfig.RegisterRoutes(RouteCollection routes) at WaterPro.MvcApplication.Application_Start() – Ralpharama Apr 28 '16 at 16:03
  • 1
    @Ralpharama You may be able to fix this by updating the nuget package for System.Web.Mvc https://www.nuget.org/packages/microsoft.aspnet.mvc/ in conjunction with this you might also need to manually remove references to that old assembly (in your web.config), sometimes in older projects nuget doesn't clean up old refs very well - in fact you might be able to fix it by simply removing the ref to the old assembly. – Lazy Coder Apr 28 '16 at 16:08
  • Thanks, looks like it's certainly something to do with that mvc dll between my local and the destination server... I'm not able to test any theories right now but will review and come back after the weekend. – Ralpharama Apr 28 '16 at 16:12
  • It's probably in a binding redirect, I think your GAC version has updated and the project is redirecting to an older assembly. I've had this happen a time or two. Look in the node for the offending assembly and remove it. – Lazy Coder Apr 28 '16 at 16:14
  • This thing? – Ralpharama Apr 28 '16 at 16:17
  • So, if I remove the dependency entry, as described, the project won't run: "An unhandled exception of type 'System.AccessViolationException' occurred in Unknown Module. Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt." ... I've updated my mvc nuget package, but that doesn't help - as I say, I can make it all run on my local machine, but it won't work when deployed to our server... – Ralpharama May 03 '16 at 14:42
  • The exact error is: Exception thrown: 'System.AccessViolationException' in DevTrends.MvcDonutCaching.dll when I remove the dependency. – Ralpharama May 03 '16 at 14:43
  • This seems very similar, but updating the references etc as they describe doesn't fix my error on the end server, yet it works locally. http://stackoverflow.com/questions/26425025/window-update-broke-mvc-application – Ralpharama May 03 '16 at 15:18

1 Answers1

0

Well, after a LOT of trial and error, I finally found a solution that works for me, for the moment:

Using nuget package manager, I reverted to Microsoft.AspNet.Mvc version 4.0.40804 for the project in question. This seems to have updated all the references and runtimes back to the 4.0.0.0 that the project was built using.

When I build, publish, and copy across the main dlls, the site now runs, rather than showing the 'Server Error in '/' Application. Runtime Error'

One thing, are there security implications for running such an old version? Maybe that needs to be a new question...

Thanks for all the help.

Ralpharama
  • 441
  • 4
  • 20