如何在ASP.NET中向串行端口或USB端口发送和接收数据? [英] How can I send and receive data to a serial port or USB port in ASP.NET?

查看:81
本文介绍了如何在ASP.NET中向串行端口或USB端口发送和接收数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发用于停车的Web应用程序.我想用连接到USB端口的设备控制网关入口,但是我们知道浏览器位于

I am developing a web application for a parking. I want to control a gateway entrance with a device connected to USB port, but we know that the browser is in a sandbox, so there isn't any access to the computer's port.

我在网上搜索后发现,有可能通过 ActiveX 进行搜索/or Java小程序,但是我对这些东西还是新手,想要完整的教程或一本描述它的维基书籍,甚至是相对于它的类库.

I searched the web and found out there is some possibility to do so via ActiveX and/or Java applets, but I'm a novice to these things and want a complete tutorial or a wiki book that describe it or even class libraries relative to.

我想通过ASP.NET应用程序(客户端)将数据发送到USB或COM端口.我知道,由于安全问题,浏览器无法执行此操作.什么是使用ActiveX的示例?

I want to send data to a USB or COM port via an ASP.NET application (client side). I know that browsers aren't able to do so because of security issues. What would be an example of using ActiveX?

推荐答案

您需要在服务器上托管ASP.NET 应用程序/网站.您的浏览器在客户端计算机上.您的客户端将从服务器请求页面,并且该网站无法托管在客户端计算机上.

You need to host an ASP.NET application/website on a server. Your browser is on a client machine. Your client will request a page from the server and the website could not be hosted on the client machine.

因此,您可以将设备连接到服务器计算机,客户端会通过该设备向您发送发布数据的请求,例如GSM调制解调器.现在,您需要将设备连接到服务器,然后可以创建 Windows 服务以拉出从数据库发布消息以通过设备发布它们.

So you can connect your device to a server machine and the client sends you request to post data through a device, e.g. a GSM modem. Now you need to connect your device to the server and you can make a Windows service to pull the posted message from the database to post them through the device.

您需要与COM端口通信.甚至您的USB设备也监听COM端口.您可以使用串行端口类与设备进行通信.您可以使用桌面应用程序执行此操作,并且我看不到使用网站的任何原因.以下链接将为您提供帮助.

You need to talk to a COM port. Even your USB devices listen to a COM port. You can use the serial port class to communicate with the device. You can do this with a desktop application and I could not see any reason for using a website. The following links will help you.

这篇关于如何在ASP.NET中向串行端口或USB端口发送和接收数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆