views:

13

answers:

1

Hi,

I've written a Generic Handler so I can access my server's COM port through javascript.

I'm doing this, because I'm writing a Web Interface to an ESP-88 from BOSE, for internal use. The code must be configurable, and I added routines for both TCP/IP support and RS232.

In a desktop app, the code runs fine, but in an ASP.net 4.0 App, the code crashes with the error "Access to the port 'COM2' is denied.". TCP/IP connections work, but serial is also required for us.

So please, how do I let ASP.net apps use my COM interfaces?

Thanks! Yvan

+1  A: 

Sounds like it is a case of permissions, the IIS server that is processing the ASP.NET pages does not have the privileges necessary to open the COM port.... as a matter of interest what are you using to communicate with the COM port?

The other clue is "Access to the port is denied" seems to suggest there is something else running. This implies that serial ports are exclusive access only, and only one process can access the serial port at any one time....

Edit:

After digging around, I think this link might be the best solution in the sense to get around the "Access denied on COM2", by using hooks and hook it in...I have not read the article but it looks like the one you are looking for...

tommieb75
nothing else's running, and I'm running from within Visual Studio. I'm currently using an emlated com port, redirected to a second one. On the second one I have hyperterminal attached. (I'm not going to send some random data to a €7500 machine ;) )I'm using the built-in functions of .net, namely System.IO.Ports .
Yvan JANSSENS
Hyperterminal is hogging up the COM2 port....and has exclusive access to it...as for System.IO.Ports there is issues with it, events does not fire properly...and mis-timings...
tommieb75
I solved the problem, not by using the article, but by using this library: http://www.codeworks.it/net/VBNetRs232.htm .It works now, but I'll had to use a thread.sleep somewhere in my code, since the device doesn't respond that fast. (350ms wait) Thanks for your answer!Yvan
Yvan JANSSENS