EmguCV Exception when published on IIS

My ASP.NET App works fine if I debug or run it on my local IIS. But if I publish it onto an IIS, it looks like EmguCV looses the dlls it needs. The bin folder of my VS project an the bin folder on the IIS are identical.

The following exception occurs:
The type initializer for ‘Emgu.CV.CvInvoke’ threw an exception.
StackTrace: at Emgu.CV.CvInvoke.cvCreateImageHeader(Size size, IPL_DEPTH depth, Int32 channels) at Emgu.CV.Image2.AllocateData(Int32 rows, Int32 cols, Int32 numberOfChannels) at Emgu.CV.Image2.set_Bitmap(Bitmap value) at CustomerserviceWizard.ImageHelper.DecodeUrl(LuminanceSource source, Bitmap bitmap, List`1 methods) in :line 213

Any help is appreciated.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

I once had a similar issue, maybe this helps in your case: please check your IIS application pool settings and make sure that you enable 32 bit applications under “Advanced Settings”.

Method 2

Alright, after a lot of research and grey hair I finally convinced my boss to just use an Desktop PC to process images with EmguCV.
The (quite obvious) reason for the exception was the missing nVidia Cuda GPU in the server.

Method 3

Error shown when i tried to execute EmguCV on IIS – Unable to load DLL 'cvextern': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

Exception – The type initializer for 'Emgu.CV.CvInvoke' threw an exception.

In my case, I solved this by enabling UI Desktop experience for windows server (In my case – Windows Server 2012 R2) because Microsoft never enabled that feature on Windows Server by default.


Solution

For Windows Server 2008

  1. Go to Start >> Administrative Tools >> Server Manager.
  2. At left side pane, click on Features.Under the Features Summary section, click on Add Features.
  3. On the Select Features page, select the Desktop Experience check box.
  4. Review required features that need to be installed and then click Add Required Features, click Next.
  5. At Confirm Installation Selections page, make sure that Desktop Experience feature will get installed, click Install.
  6. At Installation Results page, you will be asked to reboot the server to finish the installation process.
  7. Just click Close, and then click Yes to reboot the server.
  8. Once server restarts log in to server and server will finish remaining installation steps.

For Windows Server 2012

  1. Go to Start >> Administrative Tools >> Server Manager.
  2. At Server Manager, click on Features.
  3. In the Server Manager details pane, under Features Summary, click Add features.
  4. This will start the Add Features Wizard.
  5. Now, in the Features list, select Desktop Experience, and click Install.

Hope this solution can help you 🙂

Links – Solution from GitHub & Description with screenshot


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x