Answered by:
Getting error on Event Handler - INVALID_HANDLER

Question
-
User-377040936 posted
Hi,
I have a Canon x64 DLL library I use in ASP.NET 4.6.1 WebAPI, which works fine. I can initialize the camera and I can get the live view.
But when I take a picture async, I get an error: `SDKException: INVALID_HANDLE`
This is the Event handler and the error happens on DownloadReadyEvent() which is init with a Delegate:
private ErrorCode Camera_SDKObjectEvent(ObjectEventID inEvent, IntPtr inRef, IntPtr inContext) { ThreadPool.QueueUserWorkItem((state) => { try { var DownloadReadyEvent = DownloadReady; if (inEvent == ObjectEventID.DirItemRequestTransfer && DownloadReadyEvent != null) { DownloadReadyEvent(this, new DownloadInfo(inRef)); } else if (inEvent == ObjectEventID.DirItemCreated && saveFilm && DownloadReadyEvent != null) { saveFilm = false; DownloadReadyEvent(this, new DownloadInfo(inRef)); } } catch (Exception ex) { if (!IsDisposed && !ErrorHandler.ReportError(this, ex)) throw; } ObjectChanged?.Invoke(this, inEvent, inRef); }); return ErrorCode.OK; }
This is the exception details:
Can someone help me troubleshoot this issue?
Ben C.Monday, March 12, 2018 10:33 AM
Answers
-
User-377040936 posted
I got it working! I put my init code in Get Request and made my Camera object as static.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, March 12, 2018 11:45 AM
All replies
-
User-377040936 posted
Tried with an WPF Project 4.6.1 x64 and it worked fine... how can I make this work in the WebAPI?
Monday, March 12, 2018 11:05 AM -
User-377040936 posted
I got it working! I put my init code in Get Request and made my Camera object as static.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, March 12, 2018 11:45 AM -
User475983607 posted
Web API is a web application where code runs on a server in response to a request. You'll need to craft a background task to manage the camera and stop the web app from going idle. Keep in mind the camera must be attached to the server so the solution might not work in a production environment. Can you explain your project requirements?
WPF is the appropriate technology.
Monday, March 12, 2018 11:53 AM -
User-377040936 posted
I want to use a different framework for FrontEnd, a JS one and so I cant access the DLL library with JavaScript. I am building the WebAPI to comunicate with the Camera and receive pictures or liveview.
Monday, March 12, 2018 11:58 AM