Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MVC4 Project and ImageResizer

Problem: MVC 4 test application with ImageResizer on any page access responds with "Could not load type 'ImageResizer.InterceptModule'"

To test and understand how ImageResizer works a MVC4 project was created in VS 2012, a single controller was created to display a HelloWorld page. Works as expected.

Next step was to add ImageResizer from NuGet. The ImageResizer Web.Config Installation for MVC was installed. This package added three additional packages:

ImageResizer Web.Config Installation ImageResizer.MVC - MVC friendly utilitite ImageResizer

Attempting to run the application results in a yellow screen of death with the "Could not load type 'ImageResizer.InterceptModule.'

Attempt to resolve with no success include:

  1. Verify DLLs exist.
  2. Remove and reinstall packages.
  3. Copy ImageResizer dll from a working webforms application
  4. Item 1 on the ImageResizer troubleshooting guide doesn't appear to be the issue "1.Your website has a 'sub-site' (Application Folder) inside it. Application Folders inherit all Web.config settings from their parent sites, yet expect to have their own copies of all the dlls referenced by those settings in their own /bin folder. You can resolve this problem by (a) changing the app folder to a virtual folder, (b) adding a copy of ImageResizer.dll and plugins into the /bin folder inside that application also, or (c) using statements in the child Web.config to cancel out the inherited statements from the parent Web.config. Option (c) will disable image resizing within the sub-application."

Yes there is a web.config file in the views directory. Tried creating and copying image resizer dlls to a bin directory in view - no success. Tried adding a remove to the web.config in the views directory. Again no success.

like image 239
Colan Arnold Avatar asked Dec 16 '22 11:12

Colan Arnold


1 Answers

Problem resolved - self inflicted.

It seemed like a good idea to name the test project imageresizer. Which of course created a dll name imageresizer which walked all over the real imageresizer dll.

like image 125
Colan Arnold Avatar answered Dec 18 '22 00:12

Colan Arnold