我正在用戶Guest下測試我的應用程序。它崩潰,出現以下錯誤。'UnauthorizedAccessException' - 'Global .net clr networking'
「UnauthorizedAccessException」 - 「Global.net CLR聯網」
現在,我知道我可以在機器上修改安全策略允許CLR代碼在客戶操作系統中運行是可信的,但什麼人應該在做商業應用?
(簽名,並添加CAS屬性?) 我目前正在閱讀整個安全部分,但我在時間捏,所以任何指針在正確的方向將不勝感激。
編輯:我已經追溯到使用Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase類的問題。如果包含此信息,則會顯示錯誤。 我在找東西添加到清單或其他方式,以便當應用程序安裝/運行時,它會要求適當的權限。我不想讓用戶親自致電caspol或其他工具。
環境細節: - 應用程序是使用.NET 3.0 - 操作系統是Vista的
下面是那些進入這些東西相關的堆棧跟蹤:
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)
它在哪裏崩潰?在啓動?在正常操作中? – blowdart 2009-05-25 05:00:10
在啓動過程中,我的代碼的任何部分被執行之前。 – moogs 2009-05-25 05:14:35