Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Execution permission cannot be acquired PolicyException

4 views
Skip to first unread message

Julie

unread,
Aug 11, 2003, 8:03:13 PM8/11/03
to
Hello --

I would like to run my Excel/C# application on my laptop. I "deployed" the
ExcelTool.xls file (generated by VS .NET) and also the entire ExcelTool_bin
folder.

From what I remember, all I had to do on my machine to have permission to
run was to increase the Assembly Trust to "Full Trust" for every dll in the
ExcelTool_bin folder. I did this on the laptop, but I keep getting
System.Security.Policy.PolicyException: Execution permission cannt be
acquired

I looked at the Details of the exception, and it lists all of the Loaded
Assemblies (some of which are system assemblies such as mscorlib.dll). I
went through and set the permission to "Full Trust" for every one of the
Loaded Assemblies, even the system ones, but I'm still getting the security
exception.

I am setting Full Trust by using Control Panel -> Administrative Tools ->
Microsoft .NET Framework 1.1 Configuration, then selecting "Runtime Security
Policy", then "Increase Assembly Trust". In the "Trust in Assembly" popup, I
select "Make changes to the computer", then browse to the desired assembly,
then changing the Trust to Full Trust.

Can someone please tell me what I'm doing wrong? This runs fine on my
desktop and I thought I did the exact same thing on the laptop.

-- Julie


Lori Turner [MSFT]

unread,
Aug 12, 2003, 1:19:36 AM8/12/03
to
Julie,

You should really only need to set up a policy for your managed code
extension and any other assemblies you've written that are referenced by
your managed code extension. Try this for a test and see if this helps:

- First remove the policies you have set up for the aforementioned
assemblies; to determine what they are right-click Runtime Security Policy
and choose Evaluate Assembly. Delete any code groups that appear with the
exception of those code groups that are there by default [those default
code groups would be 1) Enterprise Policy - All_Code and 2) Machine Policy
- All_Code - My_Computer_Zone].

- Since it sounds like your assembly will be run from the local machine
(the laptop), then under Runtime Security Policy, go to User > Code Groups
> All_Code and create new code groups for your managed code extension and
your assemblies that it might reference. For the code group, provide
FullTrust using URL for the evidence.

Note: Always restart all instances of Word and Excel after you make code
security changes. And, if you're using Outlook, you might also need to
restart Outlook if you're using Word for Outlook's email editor.

If you still get the error message, can you please provide some more
details about 1) what beta build of Office is on the laptop, and 2) what
assemblies does your managed code extension reference?

Regards,
Lori Turner
Microsoft Beta Staff

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>> From: "Julie" <jny...@carter-incnospamplease.com>
>> Subject: Execution permission cannot be acquired PolicyException
>> Date: Mon, 11 Aug 2003 18:03:13 -0600
>> Lines: 30
>> X-Priority: 3
>> X-MSMail-Priority: Normal
>> X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
>> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
>> Message-ID: <Ok7fcXGY...@TK2MSFTNGP12.phx.gbl>
>> Newsgroups: microsoft.public.vsnet.vstools.office
>> NNTP-Posting-Host: carter-inc.com 65.100.173.166
>> Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
>> Xref: cpmsftngxa06.phx.gbl microsoft.public.vsnet.vstools.office:652
>> X-Tomcat-NG: microsoft.public.vsnet.vstools.office

Peter Torr (MS)

unread,
Aug 12, 2003, 2:32:21 AM8/12/03
to
"Julie" <jny...@carter-incnospamplease.com> wrote in message
news:Ok7fcXGY...@TK2MSFTNGP12.phx.gbl...

> Hello --
>
> I would like to run my Excel/C# application on my laptop. I "deployed" the
> ExcelTool.xls file (generated by VS .NET) and also the entire
ExcelTool_bin
> folder.

Hey,

Along with Lori's excellent suggestions, you may also want to check what
version of Office you are using. If you are only running Beta 2 (and not the
Tech Refresh) then you will need to trust the Office strongname key as
well -- the readme should tell you how to do that. If you are using Web
Services you also need to trust the physical location of System.DLL

Peter

--
Peter Torr - http://blogs.gotdotnet.com/ptorr/


This posting is provided "AS IS" with no warranties, and confers no rights

Samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


Julie

unread,
Aug 12, 2003, 5:42:00 PM8/12/03
to
>
> If you still get the error message, can you please provide some more
> details about 1) what beta build of Office is on the laptop, and 2) what
> assemblies does your managed code extension reference?
>

Lori --

Thanks for the response. I am using Microsoft Office Excel
2003 Beta (11.5329.5329) on both my desktop and laptop. Both machines are
running Windows XP Professional 5.1.2600 Service Pack 1 Build 2600.

I think that the security is working to some extent, in that if I go to the
Runtime Security Policy and select "Reset All Policy Levels", my Excel code
does not run at all. I have a Windows Form popup that normally appears, but
after the reset, I get the following message instead:

"The current .NET security policy does not permit ExcelListTool to run from
the folder .\ExcelListTool_bin\. Do not change the security policy in your
computer. The .NET security policy is controlled by your administrator or
the developer who wrote the custom macros."

I went with your suggestion and created a Code Group under
"User -> Code Group -> All_Code ->ExcelListTool". After doing this, I get
the exact same security exception I had yesterday. I cut/pasted the entire
exception below. Note that I'm pretty sure it's not Infragistics, as I added
an Infragistics toolbar where when you click it, it prints out a message.
That is still working. I suspect it has something to do with the
System.Windows.Forms/NativeWindow.Callback???? I have several actions that
results in this problem, all of which ends with this
System.Windows.Forms/NativeWindow.Callback.

Any more advice?? Thanks in advance!

-- Julie


---------- Exception Text Below ----------------

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Security.Policy.PolicyException: Execution permission cannot be
acquired.
at
Toolskin.Shell.Std.CtrlModules.DataSource.DataSourceCtrlMod.myUltraToolbarsM
anager_ToolClick(Object sender, ToolClickEventArgs e)
at
Infragistics.Win.UltraWinToolbars.UltraToolbarsManager.OnToolClick(ToolClick
EventArgs e)
at
Infragistics.Win.UltraWinToolbars.UltraToolbarsManager.FireEvent(ToolbarEven
tIds id, EventArgs e)
at Infragistics.Win.UltraWinToolbars.ToolBase.OnToolClick()
at
Infragistics.Win.UltraWinToolbars.ButtonToolUIElement.DoClickProcessing(Mous
eEventArgs e)
at
Infragistics.Win.UltraWinToolbars.ButtonToolUIElement.OnMouseUp(MouseEventAr
gs e)
at Infragistics.Win.ControlUIElementBase.ProcessMouseUp(Object sender,
MouseEventArgs e)
at System.Windows.Forms.Control.OnMouseUp(MouseEventArgs e)
at
Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea.OnMouseUp(MouseEvent
Args e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
WRDomainSetup
Assembly Version: 7.0.5000.0
Win32 Version: 11.0.5329
CodeBase:
file:///C:/Program%20Files/Microsoft%20Office/OFFICE11/EXCEL.EXE
----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
System.DirectoryServices
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windows/assembly/gac/system.directoryservices/1.0.5000.0__b03f5f7f11d50a3a/system.directoryservices.dll
----------------------------------------
System.Messaging
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windows/assembly/gac/system.messaging/1.0.5000.0__b03f5f7f11d50a3a/system.messaging.dll
----------------------------------------
System.ServiceProcess
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windows/assembly/gac/system.serviceprocess/1.0.5000.0__b03f5f7f11d50a3a/system.serviceprocess.dll
----------------------------------------
System.Data
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windows/assembly/gac/system.data/1.0.5000.0__b77a5c561934e089/system.data.dll
----------------------------------------
ExcelListTool
Assembly Version: 1.0.1319.25901
Win32 Version: 1.0.1319.25901
CodeBase: file:///C:/test/ExcelListTool_bin/ExcelListTool.DLL
----------------------------------------
Toolskin.Shell
Assembly Version: 1.0.1319.25255
Win32 Version: 1.0.1319.25255
CodeBase: file:///C:/test/ExcelListTool_bin/Toolskin.Shell.DLL
----------------------------------------
Microsoft.Office.Interop.Excel
Assembly Version: 11.0.0.0
Win32 Version: 11.0.5329
CodeBase:
file:///c:/windows/assembly/gac/microsoft.office.interop.excel/11.0.0.0__71e9bce111e9429c/microsoft.office.interop.excel.dll
----------------------------------------
office
Assembly Version: 11.0.0.0
Win32 Version: 11.0.5329
CodeBase:
file:///c:/windows/assembly/gac/office/11.0.0.0__71e9bce111e9429c/office.dll
----------------------------------------
Toolskin.Inf
Assembly Version: 1.0.1319.25250
Win32 Version: 1.0.1319.25250
CodeBase: file:///C:/test/ExcelListTool_bin/Toolskin.Inf.DLL
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System.Xml
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll
----------------------------------------
RegexAssembly11_0
Assembly Version: 0.0.0.0
Win32 Version: n/a
CodeBase:
----------------------------------------
Toolskin.Inf.Factory
Assembly Version: 1.0.1319.25250
Win32 Version: 1.0.1319.25250
CodeBase: file:///C:/test/ExcelListTool_bin/Toolskin.Inf.Factory.DLL
----------------------------------------
System.Runtime.Remoting
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windows/assembly/gac/system.runtime.remoting/1.0.5000.0__b77a5c561934e089/system.runtime.remoting.dll
----------------------------------------
Infragistics.Win.UltraWinDock.v2
Assembly Version: 2.0.5001.21
Win32 Version: 2.0.5001.21
CodeBase:
file:///C:/test/ExcelListTool_bin/Infragistics.Win.UltraWinDock.v2.DLL
----------------------------------------
Infragistics.Win.v2
Assembly Version: 2.0.5001.21
Win32 Version: 2.0.5001.21
CodeBase: file:///C:/test/ExcelListTool_bin/Infragistics.Win.v2.DLL
----------------------------------------
Infragistics.Shared.v2
Assembly Version: 2.0.5001.21
Win32 Version: 2.0.5001.21
CodeBase: file:///C:/test/ExcelListTool_bin/Infragistics.Shared.v2.DLL
----------------------------------------
Infragistics.Win.UltraWinToolbars.v2
Assembly Version: 2.0.5001.21
Win32 Version: 2.0.5001.21
CodeBase:
file:///C:/test/ExcelListTool_bin/Infragistics.Win.UltraWinToolbars.v2.DLL
----------------------------------------
System.Runtime.Serialization.Formatters.Soap
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windows/assembly/gac/system.runtime.serialization.formatters.soap/1.0.5000.0__b03f5f7f11d50a3a/system.runtime.serialization.formatters.soap.dll
----------------------------------------
DC_IAPI_Library
Assembly Version: 1.0.1299.30217
Win32 Version: 1.0.1299.30217
CodeBase: file:///C:/test/ExcelListTool_bin/DC_IAPI_Library.DLL
----------------------------------------
Infragistics.Win.UltraWinGrid.v2
Assembly Version: 2.0.5001.21
Win32 Version: 2.0.5001.21
CodeBase:
file:///C:/test/ExcelListTool_bin/Infragistics.Win.UltraWinGrid.v2.DLL
----------------------------------------
Infragistics.Win.UltraWinTree.v2
Assembly Version: 2.0.5001.21
Win32 Version: 2.0.5001.21
CodeBase:
file:///C:/test/ExcelListTool_bin/Infragistics.Win.UltraWinTree.v2.DLL
----------------------------------------

************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.

Peter Torr (MS)

unread,
Aug 17, 2003, 9:46:33 PM8/17/03
to
"Julie" <jny...@carter-incnospamplease.com> wrote in message
news:utLtNtRY...@TK2MSFTNGP09.phx.gbl...

> I went with your suggestion and created a Code Group under
> "User -> Code Group -> All_Code ->ExcelListTool". After doing this, I get
> the exact same security exception I had yesterday. I cut/pasted the entire
> exception below. Note that I'm pretty sure it's not Infragistics, as I
added
> an Infragistics toolbar where when you click it, it prints out a message.
> That is still working. I suspect it has something to do with the
> System.Windows.Forms/NativeWindow.Callback???? I have several actions
that
> results in this problem, all of which ends with this
> System.Windows.Forms/NativeWindow.Callback.

Hi,

The library you are using could be trying to generate and use temporary
assemblies.

One thing to do is to TEMPORARILY add a rule such as:

caspol -m -ag 1.1 -url c:\* FullTrust -n "DELETE_ME" -d "Full trust to
C:"

and see if that helps. If it does, then you can write some simple code to
dump the loaded assemblies and their associated evidence (unfortunately the
assembly dump generated below won't help because when execution permission
cannot be acquired, the assembly won't be loaded)

The code is something like this:

Imports System.Reflection

Dim asm As [Assembly]
Dim asms() As [Assembly]
asms = AppDomain.CurrentDomain.GetAssemblies
For Each asm In asms
If (MsgBox("Show for " & asm.GetName().Name & "?", _
MsgBoxStyle.YesNo) = MsgBoxResult.Yes) Then
Dim o As Object
For Each o In asm.Evidence
If (o.GetType() Is GetType(System.Security.Policy.Hash)) Then
MsgBox("<hash>")
Else
MsgBox(o.ToString)
End If
Next
End If
Next


Check out what evidence your assemblies are being loaded with, and look for
any assemblies with funny names (eg, random names) that could be dynamically
generated. Then you will need to grant permissions based on the evidence
that those assemblies are loaded with.

Then DELETE THE CODE GROUP ;-)

0 new messages