访问串行端口需要哪些

访问串行端口需要哪些

本文介绍了访问串行端口需要哪些 ASP.NET 权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个 asp.net 应用程序,我希望它通过串行端口与 arduino 板通信.我创建了一个可以做到这一点的 Windows 应用程序并且它工作,但是当我在我的 asp.net 应用程序上使用相同的代码时,我得到一个异常,说访问端口 COM7 被拒绝".现在我一直在网上寻找答案,我遇到了一个论坛,他们正在讨论通过使用模拟授予 asp.net 权限.我对使用 .net 框架和串行端口非常陌生.如果有人可以提供帮助,请做或发布可能有帮助的链接.

I am working on a asp.net application and I want it to communicate to a arduino board via a serial port. I created a windows application that could do that and it worked, but when I use the same code on my asp.net application, I get an exception that says that "Access to the port COM7 is denied". Now I have been surfing the net for an answer, I came across a forum where they were talking about granting permissions to asp.net by using impersonation. I am very new at using the .net framework and serial port. If anyone can help, please do or maybe post a link that might be helpful.

提前感谢.

推荐答案

ASP.net 在您的计算机上使用特定的用户帐户.就像您登录的主要帐户一样.该用户帐户无权对硬件进行任何操作.

ASP.net uses a specific user account on your computer. Just like your main account you log in with. That user account has no permissions to do anything with the hardware.

要在 ASP.net 中模拟其他帐户,请执行以下操作:

To impersonate the other account in ASP.net you do the following:

创建一个与网络用户具有所有相同权限的帐户,然后在 web.config 文件中的配置标签之间添加以下代码

Create an account that has all of the same permissions that the web user does, then in the web.config file add the following code in between the configuration tags

<identity impersonate="true" userName="somedomain
ewUser" password="newUsersPassword" />

这篇关于访问串行端口需要哪些 ASP.NET 权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 17:53