當我在朋友的Windows 7計算機上運行我的應用程序時,出現.NET安全錯誤。.NET Framework安全問題
下面是截圖
alt text http://img707.imageshack.us/img707/1340/94161244.png
,這裏是明顯的
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<assemblyIdentity version="1.0.0.0" name="Myapp.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC Manifest Options
If you want to change the Windows User Account Control level replace the
requestedExecutionLevel node with one of the following.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
If you want to utilize File and Registry Virtualization for backward
compatibility then delete the requestedExecutionLevel node.
-->
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
</asmv1:assembly>
我怎樣才能在Visual Basic 2010解決這一問題?
感謝
編輯:我做了一個臨時的解決辦法是這樣
Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles Me.Startup
Dim a As New WindowsPrincipal(WindowsIdentity.GetCurrent())
If Not a.IsInRole(WindowsBuiltInRole.Administrator) Then
MsgBox("Please Run the application as administrator")
e.Cancel = True
End If
End Sub
編輯2:我也意識到,我的朋友的勝7是有點壞了,它甚至不加載SSL certf。的網頁。怪異
請向我們展示詳細信息(也許它包含stracktrace?)。如果它包含堆棧跟蹤,請向我們顯示該位置的代碼。 – Heinzi
我只是使用「RegistryKey」和「Application.CommonAppDataRegistry」它給出了錯誤,因爲註冊表訪問請求我猜 –