0
点赞
收藏
分享

微信扫一扫

UiPath设计个税自动化报拒绝访问错误处理及其相关概念

大漠雪关山月 2022-04-27 阅读 20

目录

背景

问题发现和解决

问题一

问题二

问题三

参考文献


背景

这段时间在做一些个税(《自然人电子税务局(扣缴端)》)自动化的开发,社区版Studio迎来了2022.4.0的更新。在正式开发前,简单测试一下元素的捕捉,一连发现有几个技术点,而且设计完成后运行时报特别奇怪的错误(见下文详述)。在深入搜索了相关问题以后,发现都没能解决根本原因。现特意把这个过程记录下来备忘。

问题发现和解决

问题一

扣缴端程序打开的时候提示会更改系统(UAC),这个会导致robot打开时停顿,可以修改“用户账户控制设置”,变为“从不通知”。

问题二

开始设计的时候打开Studio捕捉程序的元候提示权限不够“Cannot access target application. Elevated privileges might be required. Try running UiPath Studio as an administrator.”

根据提示处理也不复杂,把Studio改为管理员运行。

勾选“以管理员身份运行程序”

问题三

修复后可以捕捉元素,设计完成以后运行测试,发现运行时弹出错误“One or more errors occurred.(拒绝访问。)”

RemoteException wrapping System.AggregateException: One or more errors occurred. (拒绝访问。)  ---> RemoteException wrapping System.ComponentModel.Win32Exception: 拒绝访问。 
   at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited)
   at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited)
   at System.Diagnostics.Process.GetOrOpenProcessHandle()
   at System.Diagnostics.Process.EnsureWatchingForExit()
   at System.Diagnostics.Process.set_EnableRaisingEvents(Boolean value)
   at UiPath.Service.UserHost.AttendedServiceProxy.RegisterClientProcess(Int32 clientPid)
   at UiPath.Service.UserHost.StudioOperations.Prepare(ClientProcessMessage message, CancellationToken ct)
   at UiPath.Service.Core.Utils.TaskUtils.WithShortWait(Task task, TimeSpan wait)
   at UiPath.Service.UserHost.StudioOperations.<>c__DisplayClass7_0.<<RunJob>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at UiPath.CoreIpc.CancellationHelper`1.Invoke[TResult](TId requestId, Func`2 func)
   at UiPath.CoreIpc.Server.<>c__DisplayClass7_3.<<-ctor>g__InvokeMethod|6>d.MoveNext()
--- End of stack trace from previous location ---
   at UiPath.CoreIpc.Server.<>c__DisplayClass7_1.<<-ctor>g__HandleRequest|3>d.MoveNext()
--- End of stack trace from previous location ---
   at UiPath.CoreIpc.Server.<>c__DisplayClass7_2.<<-ctor>b__5>d.MoveNext()
--- End of stack trace from previous location ---
   at UiPath.CoreIpc.Helpers.Timeout[TResult](TimeSpan timeout, List`1 cancellationTokens, Func`2 func, String message, Func`2 exceptionHandler)
	--- End of inner exception stack trace ---
   at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited)
   at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited)
   at System.Diagnostics.Process.GetOrOpenProcessHandle()
   at System.Diagnostics.Process.EnsureWatchingForExit()
   at System.Diagnostics.Process.set_EnableRaisingEvents(Boolean value)
   at UiPath.Service.UserHost.AttendedServiceProxy.RegisterClientProcess(Int32 clientPid)
   at UiPath.Service.UserHost.StudioOperations.Prepare(ClientProcessMessage message, CancellationToken ct)
   at UiPath.Service.Core.Utils.TaskUtils.WithShortWait(Task task, TimeSpan wait)
   at UiPath.Service.UserHost.StudioOperations.<>c__DisplayClass7_0.<<RunJob>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at UiPath.CoreIpc.CancellationHelper`1.Invoke[TResult](TId requestId, Func`2 func)
   at UiPath.CoreIpc.Server.<>c__DisplayClass7_3.<<-ctor>g__InvokeMethod|6>d.MoveNext()
--- End of stack trace from previous location ---
   at UiPath.CoreIpc.Server.<>c__DisplayClass7_1.<<-ctor>g__HandleRequest|3>d.MoveNext()
--- End of stack trace from previous location ---
   at UiPath.CoreIpc.Server.<>c__DisplayClass7_2.<<-ctor>b__5>d.MoveNext()
--- End of stack trace from previous location ---
   at UiPath.CoreIpc.Helpers.Timeout[TResult](TimeSpan timeout, List`1 cancellationTokens, Func`2 func, String message, Func`2 exceptionHandler)

先说结论,查阅了UiPath官方论坛多个帖子,说杀掉UiPath.Service.UserHost.exe进程后可以正常运行,我试了试果然可以。

我直观的认为是某些权限的问题,杀进程真是比较奇怪的解决方法。先在官网查阅了一下UiPath.Service.UserHost.exe的作用,主要有两大类,一、和OC通信,发心跳,接收命令;二、Robot可以驱动其执行、管理、监控windows的进程。

It is responsible for sending the Robot heartbeat to Orchestrator to communicate execution status or receive new execution orders, acting as a proxy between Orchestrator and the execution hosts.

Windows sessions in which processes are executed are managed and monitored by the Robot service, while also being trusted with the credentials for Robots.

她有两种运行模式,服务模式和用户模式(关于这两种模式的详细内容另文再述),简单来说服务模式就是unattended robot,machine administrator权限下系统服务运行,用户不登录也可以运行;用户模式就是attended robot,一般用户登录后运行,权限是用户的权限。

论坛的帖子说可能是因为现在Studio是管理员运行,而UiPath的服务是当前用户(UiPath.Service.UserHost.exe),两个进程之间操作系统不允许访问导致。杀死该进程以后,其实会再次启动相同的进程,那为何新的进程又可以了呢?真是很奇怪。

参考文献

Unable to Capture From Higher Integrity Level Windows Apps

Unable to Capture From Higher Integrity Level Windows Apps

Errors When Running as Administrator

Errors When Running as Administrator

Access Denied to launch an application when running UIPath - Robot - UiPath Community Forum

Access Denied to launch an application when running UiPath Studio

举报

相关推荐

0 条评论