Pelco Developer Network (PDN)

System.runtime.interopServices.SEHExeption - DS Pelco API Troubleshooting

Digital Sentry Box

Need Help
I'm getting System.Runtime.InteropServices.SEHException when i try to run the ViewVideo to test to make sure it is working on my system. this is a fresh install so i don't know what i'm doing wrong.

Thanks for your help

Hello there!

Most often I see this error when there is a mismatch between Debug and Release. When you're running the code, it's important to check that these 3 things are all set properly:

1. VX build configuration (Debug / Release)
2. DLL version (Debug / Release)
3. SDK PATH string in Environment variable (pointing to Debug or Release folder of the SDK)

In addition to these suggestions, please look over our Forum Guidelines here: Forum Guidelines. Please describe what you're trying to do when you encounter this issue, and since you're using the sample, exactly which line of code is throwing the exception.

Pelco SDK does include a logging EXE that you can use to designate what you want logged and into what folder. These .log files can be very helpful in determining any problems with the Pelco SDK (PelcoSDK.log) or streaming errors by analyzing the information in MPF.log.

Here is the e-mail that i sent to api support.

When you get a chance can someone walk me through what needs to be put on the digital sentry box to get the encoders to work, as of right now, I have on the DS box 7.14.133, and om my box I’m running the SDK 4.2.1 I have checked that tine API bundle 7.14 has been installed. I get device is offline even though I can get to the machine.

Thanks for your post, I'm glad you found your way here. The email address is no longer being actively monitored; we're using the forum primarily now. Also thank you very much for letting us know what versions of these items you are using; that helps a lot!

I did a quick test this afternoon with an encoder in our Partner lab attached to our Digital Sentry (@ if you have access to the lab), and I was able to stream video using the ViewVideo sample code to it; so it should work in theory if things are set up properly.

When using Pelco SDK with a Digital Sentry, you need to install the DS FrameSever and DS Pelco API services from the bundle package available on for download. It sounds like you've done some of that already. Are you able to stream video on the Digital Sentry using DS ControlPoint? That will at least let you know if the camera and encoders are set up to DS properly.

After checking that, and checking that both the DS FrameServer and DS Pelco API services are installed and running, you can check if they are running correctly by trying these URLS:

1. http://{DS_IP]:60001/SystemManagerDevice.xml <-- this will result in a bunch of XML for the system manager service that the DS Pelco API is emulating.
2. http://{DS_IP]:60002/Device.xml <-- this will result in a bunch of XML for the recording service that the DS Pelco API is emulating.
3. http://[DS_IP]:60003-60008/Device.xml <-- this will result in XML for analog devices and encoders connected to the DS. One of these ports should return info.
4. http://{DS_IP]:60009-60010/Device.xml <-- this will result in XML for IP devices connected to the DS that are being emulated by the DS Pelco API service.

If you aren't getting any XML trying these URLs at all, something is wrong with the services and their running / installation on the Digital Sentry. I recommend that you reach out and contact Pelco Product Support for help setting them up if this is the case.

If this is not the case, please let me know what logging information you have using Pelco SDK and the Forum Guidelines posted here.

both PelcoAPI and FrameServer are running, i get page not found when trying to get to the xml files.

This tells us that the DS Pelco API service is either not running or is not running properly.

Check the Services on the DS to ensure that both the DS Frame Server and DS Pelco API services are both listed there and running. If they aren't listed then they should be installed (or re-installed if necessary). If they are listed and running, but the XML does not come up in the web browser, then they cannot be connected to. Assuming you're checking for this XML using a browser on the DS itself (to eliminate any potential network communication issue), then the next step is to check DS Pelco API logging. You can do this using the following steps:

* How to enable logging for DSPelcoAPI: on the Digital Sentry, navigate to "C:\Users\DSNVSUser\AppData\Local\Pelco\DSPelcoAPI\" folder. Edit PelcoAPISettings.xml using notepad and set to 1. Restart the service and PelcoAPIService.txt should appear in the same directly and log calls that are using the Pelco API. (Remember that the DigitalSENTRY Pelco API Service in the "services" window of Control Panel should be Logged On as DSNVSUser. Default Password: Pelco123).

The DS Pelco API service does not tend to like it if the password has been changed from admin/admin. It is possible to use non-default passwords, but there is a special and specific way to change this. There is an article on Knowledge Base specific about addressing this that you can find here: How to update the DS API password connected to a DS system..

If you continue to have problems that you cannot figure out in getting the DS and the DS Pelco API service up and running properly, please reach out to Pelco Product Support. That team is easily accessible and better suited for troubleshooting that the DS and its services are running correctly.

so it looks like i have found the problem just don't know how to fix yet. seems that the api service is trying to connect to the old IP vs trying to run on the new machine IP. I had to change them when i was setting up the box.

[2016-09-28T09:01:44]PelcoAPI: Checking for valid system: Name:dsservices, IP:, Type: DigitalSENTRY

this IP is the old IP, is it as simple as deleting the folder for the or going through the quick setup again?

ok i tried to go through the quick setup and it is still seeing the old IP. is there a registry setting that holds this IP? or an xml file?

things I have tried so far and i'm really glad this is just a test box:

1. deleting the folder under the DSPelcoAPI directory - failed to change
2. un-install DSPelcoAPI and FrameService from the machine.
3. looking for references in the registry with the

what am i missing.

I suggest that you uninstall both the DS Frame Server service and DS Pelco API service as step 1. Then after that, navigate to "C:\Users\DSNVSUser\AppData\Local\Pelco\DSPelcoAPI" and delete the directory files there - one of them no doubt matches to the old IP address. If possible, reboot next (just in case, it can't hurt). Then reinstall the DS Frame Server and DS Pelco API services. Finally, run the DS Quick Setup steps to set up the system.

After this, double check that directory to see if there is a new folder that matches the new IP address. You can also enable the logging on the DS Pelco API service after doing this to be sure that, in the log, it is using the correct IP address (edit PelcoAPISettings.xml logging to '1' and restart the service, logs are generated in the AppData\Local\Pelco\DSPelcoAPI directory).

Following these steps I want to mention that reaching out to our Product Support teams is the best way to resolve issues with the DS, as well as the DS Frame Server and DS Pelco API services running properly. I'm happy to help out as best I can, however, this does generally fall into their realm of expertise more than my own.

so i wanted to put down the scenario that i found where just uninstalling and re installing the API does not fix the problem. If you change the IP of the box you have to open DS ControlPoint in the DSNVUser account then go to system and edit system to change the IP. Even after i had gone through and uninstalled and reinstalled the DSAPI bundle it still kept the old IP until I changed it.

Good to know, thanks for the update.

I was helping on a DS system the other day where the IP address had changed, we did the steps differently (as I described above; stop services, uninstall, delete folder, reinstall). One difference that I realized later was that I completely uninstalled all DS applications, then deleted the leftover folder in the DSPelcoAPI folder, and then installed things over again. This worked in our case. The method that you describe is much easier, so I definitely appreciate the info.

Lee -

What Encoder are you using with DS? I see from our previous posts that you're using SDK 4.2.1.

What is the video stream set to for the encoder when you check under "VAU(s)->Cameras" in DS Admin? There is currently a known issue with the streaming libs that the Pelco SDK uses where video cannot be streamed from certain encoders running at D1 Resolution. If they are set to 2CIF or CIF, streaming should work just fine.

We are hoping to put out an updated build that corrects this streaming behavior with new versions of the streaming libs at some point in the future (which will basically be a new update to Pelco SDK version). I do not have a timeline for this as of today.