“UnauthorizedAccessException” - “全球\ .NET CLR联网” [英] 'UnauthorizedAccessException' - 'Global\.net clr networking'
问题描述
我测试下的用户客户我的应用程序。它崩溃并出现以下错误。
UnauthorizedAccessException' - 'Global.net CLR联网
现在,我知道我可以修改安全策略的机器上,让CLR code。在客户操作系统中运行是可信的,但什么人应该做商业应用程序?
(注册,并加入中科院属性?) 我目前正在看整个安全部分,但我的时间掐,所以正确的方向前进的指针将AP preciated。
编辑:我已经追查问题使用类Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase。如果这包括,出现错误。 我在寻找的东西添加到清单或一些其他的方式,这样,当应用程序被安装/运行,它会要求相应的权限。我不希望有要求用户亲自打电话caspol或其他工具。
环境细节: - 应用程序是使用.NET 3.0 - 操作系统是Vista的
下面是相关的堆栈跟踪对那些为这些事情:
未处理的异常信息:System.UnauthorizedAccessException:访问路径格洛
BAL \ .NET CLR联网被拒绝。
在System.IO .__ Error.WinIOError(的Int32错误code,字符串maybeFullPath)
在System.Threading.Mutex<>。c__DisplayClass3< .ctor> b__0(对象USERDATA)
在System.Runtime.CompilerServices.RuntimeHelpers.Execute codeWithGuaranteedCl
eanup(试code code,清理code撤销code,对象USERDATA)
在System.Threading.Mutex..ctor(布尔initiallyOwned,字符串名称,布尔和放大器;
createdNew,MutexSecurity mutexSecurity)
在System.Diagnostics.SharedUtils.EnterMutexWithoutGlobal(字符串mutexName,男
UTEX和放大器;互斥)
在System.Diagnostics.SharedPerformanceCounter.Verify(CategoryEntry * currentC
ategoryPointer)
在System.Diagnostics.SharedPerformanceCounter.FindCategory(CategoryEntry ** - [R
eturnCategoryPointerReference)
在System.Diagnostics.SharedPerformanceCounter.GetCounter(字符串counterName,
字符串实例名,布尔enableReuse,PerformanceCounterInstanceLifetime李
fetime)
在System.Diagnostics.SharedPerformanceCounter..ctor(字符串catName,串c
ounterName,字符串实例名,PerformanceCounterInstanceLifetime寿命)
在System.Diagnostics.PerformanceCounter.Initialize()
在System.Diagnostics.PerformanceCounter.set_RawValue(Int64值)
在System.Net.NetworkingPerfCounters.Initialize()
在System.Net.Configuration.SettingsSectionInternal..ctor(SettingsSection秒
化)
在System.Net.Configuration.SettingsSectionInternal.get_Section()
在System.Net.Sockets.Socket.InitializeSockets()
在System.Net.Sockets.Socket.get_SupportsIPv4()
在Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.get_
主机名()
在Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Regi
sterChannel(布尔SecureChannel)
在Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(
的String []命令行)
是否有可能将它添加到您的app.config文件?
<结构>
< system.net>
<设置>
< performanceCounters启用=FALSE/>
< /设置>
< /system.net>
< /结构>
这将直接联网类不尝试创建性能计数器不根据来宾帐户的工作。
在.NET Framework 4中和高,但由于存在错误,上面的设置shsould工作未能在早期版本中。
I'm testing my application under the user Guest. It crashes with the following error.
'UnauthorizedAccessException' - 'Global.net clr networking'
Now, I know I can edit the security policy on the machine to allow CLR code running under guest to be trusted, but what should one do on a commercial app?
(Sign, and add CAS attributes?) I'm currently reading the whole security section, but I'm in a time pinch, so any pointers in the right direction will be appreciated.
EDIT: I've traced the problem to using the class Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase. If this is included, the error appears. I'm looking for something to add to the manifest or some other way so that when the application is installed/run, it will ask for the appropriate permissions. I don't want to have to ask the user to personally call caspol or some other tool.
Environment Details: - App is using .NET 3.0 - OS is Vista
Here's the relevant stack trace for those into these things:
Unhandled Exception: System.UnauthorizedAccessException: Access to the path 'Glo
bal\.net clr networking' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.Threading.Mutex.<>c__DisplayClass3.<.ctor>b__0(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCl
eanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.Mutex..ctor(Boolean initiallyOwned, String name, Boolean&
createdNew, MutexSecurity mutexSecurity)
at System.Diagnostics.SharedUtils.EnterMutexWithoutGlobal(String mutexName, M
utex& mutex)
at System.Diagnostics.SharedPerformanceCounter.Verify(CategoryEntry* currentC
ategoryPointer)
at System.Diagnostics.SharedPerformanceCounter.FindCategory(CategoryEntry** r
eturnCategoryPointerReference)
at System.Diagnostics.SharedPerformanceCounter.GetCounter(String counterName,
String instanceName, Boolean enableReuse, PerformanceCounterInstanceLifetime li
fetime)
at System.Diagnostics.SharedPerformanceCounter..ctor(String catName, String c
ounterName, String instanceName, PerformanceCounterInstanceLifetime lifetime)
at System.Diagnostics.PerformanceCounter.Initialize()
at System.Diagnostics.PerformanceCounter.set_RawValue(Int64 value)
at System.Net.NetworkingPerfCounters.Initialize()
at System.Net.Configuration.SettingsSectionInternal..ctor(SettingsSection sec
tion)
at System.Net.Configuration.SettingsSectionInternal.get_Section()
at System.Net.Sockets.Socket.InitializeSockets()
at System.Net.Sockets.Socket.get_SupportsIPv4()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.get_
HostName()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Regi
sterChannel(Boolean SecureChannel)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(
String[] commandLine)
Is it possible to add this to your app.config file?
<configuration>
<system.net>
<settings>
<performanceCounters enabled="false" />
</settings>
</system.net>
</configuration>
This will direct the networking classes to not try to create performance counters which doesn't work under the Guest account.
The above setting shsould work in .NET Framework 4 and higher but due to a bug fails in in earlier versions.
这篇关于“UnauthorizedAccessException” - “全球\ .NET CLR联网”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!