什么ASP.NET的权限,我需要访问一个串行端口?串行、端口、权限、ASP

2023-09-03 05:45:32 作者:为你醉为你伤

我工作的一个asp.net应用程序,我希望它通过串口通信,一个Arduino板。我创建了一个Windows应用程序,可以做到这一点,它的工作,但是当我用同样的code对我的asp.net应用程序,我得到一个异常,指出访问端口COM7被拒绝。现在,我一直在网上冲浪的答案,我遇到了一个论坛,让他们在谈论使用模拟权限授予asp.net。我很新,在使用.NET Framework和串口。如果有人可以帮助,请不要或者张贴可能有帮助的链接。

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文件中添加以下code在配置标签之间的帐户

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\newUser" password="newUsersPassword" />
 
精彩推荐