I'm using EmguCV for face detection in my ASP.NET project. When I run the project from Visual Studio, everything works correct.
Then I published release build via Folder profile and then just uploaded this published build to smarterasp.net.
Application is working in general. But when the application is trying to detect faces in images, an exception is throwed:
System.AggregateException: One or more errors occurred. ---> System.TypeInitializationException: The type initializer for 'Emgu.CV.CvInvoke' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'cvextern': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at Emgu.CV.CvInvoke.RedirectError(CvErrorCallback errorHandler, IntPtr userdata, IntPtr prevUserdata)
at Emgu.CV.CvInvoke..cctor()
--- End of inner exception stack trace ---
at Emgu.CV.Image`2.AllocateData(Int32 rows, Int32 cols, Int32 numberOfChannels)
at Emgu.CV.Image`2.set_Bitmap(Bitmap value)
at FaceDetection.FaceDetector.GetFaces(Bitmap img) in D:\Programming\C#Projs\FacelessBrowserTT_DIV_CONTAINER\FaceDetection\FaceDetector.cs:line 22
at ImageModification.FaceBlurModificator.Modify(Image img) in D:\Programming\C#Projs\FacelessBrowserTT_DIV_CONTAINER\ImageModification\FaceBlurModificator.cs:line 21
at FacelessBrowserTT.Controllers.HomeController.<>c__DisplayClass4_0.<PreparePage>b__1() in D:\Programming\C#Projs\FacelessBrowserTT_DIV_CONTAINER\FacelessBrowserTT\Controllers\HomeController.cs:line 81
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at FacelessBrowserTT.Controllers.HomeController.<PreparePage>d__4.MoveNext() in D:\Programming\C#Projs\FacelessBrowserTT_DIV_CONTAINER\FacelessBrowserTT\Controllers\HomeController.cs:line 86
---> (Inner Exception #0) System.TypeInitializationException: The type initializer for 'Emgu.CV.CvInvoke' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'cvextern': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at Emgu.CV.CvInvoke.RedirectError(CvErrorCallback errorHandler, IntPtr userdata, IntPtr prevUserdata)
at Emgu.CV.CvInvoke..cctor()
--- End of inner exception stack trace ---
at Emgu.CV.Image`2.AllocateData(Int32 rows, Int32 cols, Int32 numberOfChannels)
at Emgu.CV.Image`2.set_Bitmap(Bitmap value)
at FaceDetection.FaceDetector.GetFaces(Bitmap img) in D:\Programming\C#Projs\FacelessBrowserTT_DIV_CONTAINER\FaceDetection\FaceDetector.cs:line 22
at ImageModification.FaceBlurModificator.Modify(Image img) in D:\Programming\C#Projs\FacelessBrowserTT_DIV_CONTAINER\ImageModification\FaceBlurModificator.cs:line 21
at FacelessBrowserTT.Controllers.HomeController.<>c__DisplayClass4_0.<PreparePage>b__1() in D:\Programming\C#Projs\FacelessBrowserTT_DIV_CONTAINER\FacelessBrowserTT\Controllers\HomeController.cs:line 81
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()<---
What's interesting is that there're my local paths of Home Controller and other files in the exception:
D:\Programming\C#Projs\FacelessBrowserTT_DIV_CONTAINER\FacelessBrowserTT\Controllers\HomeController.cs
D:\Programming\C#Projs\FacelessBrowserTT_DIV_CONTAINER\FaceDetection\FaceDetector.cs
...
Maybe that's the reason? Why there're my local paths somewhere in the deployed application?
I have never deployed a project before, so it's 100% there's some stupid mistake I made. What am I doing wrong?