What ASP.NET permissions do I need to access a serial port?(访问串行端口需要哪些 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 权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:访问串行端口需要哪些 ASP.NET 权限?
基础教程推荐
- 将 XML 转换为通用列表 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30