Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

NI-CAN application fails when run as a .NET web service

I have a test application which communicates via a USB-8473 CAN bus interface.  The application works fine until I try to run it as a .NET web service.  When run as a web service I get a "(Hex 0xBFF62002) An internal error occurred in the NI-CAN driver.  A description is located in the file NicanErr.txt in your ..\NI-CAN\bin folder (typically located at C:\Program Files\National Instruments\..).  Solution:  Email or fax the NicanErr.txt file to National Instruments for tech" error.  Initially I was not getting the NiCanErr.txt file, but I enabled writing to the specified directory by the ASP.NET user and now I get the following NiCanErr.txt contents:

 

[OSINFO_SECTION]

OS=Microsoft Windows XP Workstation          

Service_Pack=Service Pack 3 (Build 2600)

[CURRENT_SECTION]

Section_Index=0

[DRIVER_VERSION_SECTION]

NICANFRM.DLL_VERSION=2.5.4f3

DRIVERS\NICANPK.DLL_VERSION=2.5.4f3

NICANPU.DLL_VERSION=2.5.4f3

NICANTSK.DLL_VERSION=2.5.4f3

NICANCFQ.DLL_VERSION=2.6.0f0

NCVI.DLL_VERSION=2.6.1.8198

NICAN.DLL_VERSION=2.5.4f3

NICAN_S1.NFW_VERSION=2050300

NICAN_S2.NFW_VERSION=2050300

[INDEX_1]

Local_Time= 06/07/2010 11:39:55.421

Err_Status= Status:0xb1020002-Location:0x30000000-Internal:0x01020000

Function= ncOpenObject-CAN8

 

 

I really need to get this working within the web service context.  Any help on troubleshooting this would be appreciated!

 

Thanks,

Richard 

0 Kudos
Message 1 of 16
(4,834 Views)

Hi Richard,

 

Thanks for posting on the NI Discussion Forums! I looked into this a little further for you, but unfortunately, the NI-CAN driver does not offer .NET support. 

Best Regards,
Swathi B
0 Kudos
Message 2 of 16
(4,809 Views)

Thanks for the reply.  Unfortunately I don't think you understand my problem.  The NI-CAN support works fine from my VB.NET application.  The problem arises only when I try to execute that application from within a .NET web service.  It seems likely there is some issue of the NI-CAN library using a resource which is accessable from an application running outside the web service context, and not being able to from within the web service context.  The Error log file appears to point to a specific location in the code where the problem arises but the reported error isn't specific as to what the problem is.  What is the NI-CAN library and/or driver trying to do at the point of the error?

 

Thanks,

Richard

0 Kudos
Message 3 of 16
(4,793 Views)
Hi Richard,

As you can see, besides the Err_Status line, the rest of the error log provides only version details of the driver components. As I had mentioned, since the NI-CAN driver does not officially offer .NET support, these drivers have not been tested to work with .NET or a .NET web service. We are looking to provide .NET support in the future but because this currently hasn't been tested, we do not know how it would behave and, unfortunately, can't really give you more information on the cause of this error.
Best Regards,
Swathi B
0 Kudos
Message 4 of 16
(4,772 Views)
What is the meaning of the StatusCode, Location, and Internal values?  Surely there is some clue here as to what the problem might be.  How can I go about troubleshooting this problem?
0 Kudos
Message 5 of 16
(4,769 Views)

Hi Richard,

 

I did look into obtaining more details on the error and have discussed it with my colleagues, but again, because we haven't previously tested the NI-CAN driver in this setting, we don't have a record of exactly what the error represents. I wish I could be of more help to you, but unfortunately, our resources are limited with NI-CAN applications in .NET interfaces.

Best Regards,
Swathi B
0 Kudos
Message 6 of 16
(4,756 Views)

I appreciate you're feedback and I understand the issues of limited resources as well.  My questions have more to do with a concern that you're focusing on the wrong part of my question.  The application and NI-CAN function calls all work fine in the context of a regular GUI user.  It's not a question of whether I can use the NI-CAN API from a .NET application.  That already works fine.  It ONLY fails when run as the user identity under which web services execute.  My question is "Why does that matter"?  What resources is it trying to access that are available when running as an interactive user that are not available as the non-interactive user identity used to run the web service?

 

Thanks again for your responses.

0 Kudos
Message 7 of 16
(4,753 Views)

Richard,

 

I did some further research with other colleagues in R&D and was able to identify that the reported internal error is a result of the operating system being unable to create a Mutex. A Mutex is requested by NI-CAN when calling openObject to ensure that the object can only be accessed by one thread at a time. Unfortunately, since we haven't tested NI-CAN in .NET Web Service applications, it is hard to know what a suitable workaround would be. Perhaps you can use this information along with other web resources to get around this.

Best Regards,
Swathi B
0 Kudos
Message 8 of 16
(4,712 Views)

THANKS!  That sounds like it could be a really useful piece of information!  I'll see what I can come up with.

 

Is there any indication as to why the Mutex couldn't be created?  Is it a permissions issue?

 

Thanks again,

Richard 

0 Kudos
Message 9 of 16
(4,693 Views)

Richard,

 

I don't really have more information than what I previously posted, which is that the operating system failed to create a Mutex.. sorry!

Best Regards,
Swathi B
0 Kudos
Message 10 of 16
(4,672 Views)