unhandled exception on initialization's LinkDemand (workaround suggested)

Mar 16, 2009 at 11:03 PM
Edited Mar 16, 2009 at 11:05 PM
Just in case anyone runs across this error, I'm posting what I found and how I worked around it.
Environment: win2k8 server with hyper V (used for hosting the another machine w/sharepoint IIS server), (virtualized) win2k8 standard 'web server' with Sharepoint 2007, win2k3r2 enterprise ed. sql server.
Problem: saved the downloaded files to an NT fileshare, and ran them from a mapped drive to this fileshare - see below for error detail
Solution: copy the files to a local directory on the webserver before running them (as per the instructions in another discussion thread)

Unhandled Exception: System.Security.SecurityException: Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' failed.

at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed)

at System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Object assemblyOrString, SecurityAction action, Boolean throwException)

at System.Security.CodeAccessSecurityEngine.CheckSetHelper(CompressedStack cs, PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Assembly asm, SecurityAction action)

at SPWakeUp.Program.InitSiteList(String startsite, String discover, ArrayList excludeList)

at SPWakeUp.Program.Main(String[] args)

The action that failed was:

LinkDemand

The type of the first permission that failed was:

Microsoft.SharePoint.Security.SharePointPermission

The first permission that failed was:

<ipermission objectmodel="True" version="1" class="Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">



The demand was for:


<ipermission objectmodel="True" version="1" class="Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">

</ipermission>



The granted set of the failing assembly was:


<ipermission access="Open" version="1" class="System.Security.Permissions.FileDialogPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

<ipermission userquota="512000" allowed="ApplicationIsolationByUser" version="1" class="System.Security.Permissions.IsolatedStorageFilePermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

<ipermission flags="Execution" version="1" class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

<ipermission clipboard="OwnClipboard" window="SafeTopLevelWindows" version="1" class="System.Security.Permissions.UIPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

<ipermission url="file:///Z:/spwakeup/SPWakeUp.exe" version="1" class="System.Security.Permissions.UrlIdentityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

<ipermission zone="Internet" version="1" class="System.Security.Permissions.ZoneIdentityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

<ipermission level="SafePrinting" version="1" class="System.Drawing.Printing.PrintingPermission, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">

</ipermission>



The assembly or AppDomain that failed was:

SPWakeUp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

The Zone of the assembly that failed was:

Internet

The Url of the assembly that failed was:

file:///Z:/spwakeup/SPWakeUp.exe

</ipermission></ipermission></ipermission></ipermission></ipermission></ipermission></permissionset>
</permissionset>
</ipermission>