访问端口“COM4”被拒绝 [英] Access to the port 'COM4' is denied

查看:3255
本文介绍了访问端口“COM4”被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的Arduino(有些微控制器),和我做了一个ASP.net页面与之通信。我连接到Arduino的串口COM4。当我运行ASP.net网站,我收到以下错误:

I am using arduino (some micro-controller), and I made an ASP.net page to communicate with it. I connected arduino to serial-port COM4. When I run the ASP.net website, I get the following error:

异常详细信息:System.UnauthorizedAccessException:对端口COM4被拒绝。

Exception Details: System.UnauthorizedAccessException: Access to the port 'COM4' is denied.

ASP.NET未被授权访问所请求的资源。考虑授予资源ASP.NET请求标识访问权限。 ASP.NET有一个基进程标识(通常{MACHINE} \\ ASPNET,在IIS 5或网络服务IIS 6和IIS 7,并在IIS 7.5中配置的应用程序池标识),如果应用程序没有模拟时使用。如果应用程序是通过模仿,则标识将为匿名用户(通常为IUSR_MACHINENAME)或经过身份验证的请求用户。

ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and the configured application pool identity on IIS 7.5) that is used if the application is not impersonating. If the application is impersonating via , the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.

要ASP.NET访问权限授予某个文件,用鼠标右键单击资源管理器中的文件,选择属性,然后选择安全选项卡。点击添加添加适当的用户或组。突出显示ASP.NET帐户,并检查盒为所需的访问。

To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

现在我知道这听起​​来像该解决方案是正确的有:授予asp.net机会......但我不知道他们在说些什么文件!
所以请任何人可以指出解决办法吗?
PS:我第一次做了一个Windows窗体应用程序和它的工作。因此,有没有别的使用COM4。

now i know it may sound like the solution is right there: " to grant asp.net access to..." but i don't know what file they are talking about! So please can anybody point out the solution ? PS: I first did a windows form application and it worked. So there is nothing else using the COM4.

先谢谢了。

推荐答案

忽略它的奇怪的是,Web应用程序应该跟服务器上的COM端口,问题如下:默认情况下,IIS中的ASP.NET应用程序低特权用户下运行(如在错误消息中指定)。该用户不允许访问端口。

控制台应用程序是谁发动它的用户下运行。我假设你和你的机器上的管理员。

Ignoring that it's strange that a web application should talk to a COM port on the server, the issue is as follows: by default an ASP.NET application in IIS runs under a low privilege user (as specified in the error message). That user is not allowed to access the port.
A console application runs under the user who launched it. I'm assuming that's you and you're an admin on the machine.

要获得ASP.NET做同样的打开IIS(开始 - 运行 - INETMGR),选择应用程序池,选择您的Web应用程序在其下运行的应用程序池,单击高级设置,设置身份字段到你的用户。
重新启动应用程序池并启动Web应用程序。

To get the ASP.NET doing the same open IIS (Start - Run - inetmgr), select 'Application Pools', choose the app pool under which your web application is running, click 'Advanced Settings', set the 'Identity' field to your user. Restart the app pool and launch the web application.

这篇关于访问端口“COM4”被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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