My SharePoint 2010 solution comprises of 2 Features. One feature uses the Flee library to do some mathematical calculations in some code behind. The solution has a number of class libraries that I have written.
All are set to Target Framework .NET 3.5 and are signed.
The features are essentially made of Application Pages (with images/css for good measure).
All has been running smoothly. I changed deployment of the referenced class libraries from GAC to Web Application yesterday.
This morning when I booted up, IIS didn't start and therefore I could not deploy so I had to reboot. However, since the reboot and I have gone into the screen that uses the Flee in the code behind, it has started throwing the following exception:
Server Error in '/' Application.
--------------------------------------------------------------------------------
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Source Error:
[No relevant source lines]
Source File: c:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\a225d0da\83ec41b8\App_Web_editPlantdata.aspx_-758514286.qeqss8gf.0.cs Line: 0
Stack Trace:
[SecurityException: Request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
System.Security.CodeAccessPermission.Demand() +54
System.Reflection.Emit.DynamicMethod.PerformSecurityCheck(Type owner, StackCrawlMark& stackMark, Boolean skipVisibility) +269
System.Reflection.Emit.DynamicMethod..ctor(String name, Type returnType, Type[] parameterTypes, Type owner) +70
Ciloci.Flee.Expression`1.CreateDynamicMethod() +473
Ciloci.Flee.Expression`1.Compile(String expression, ExpressionOptions options) +491
Ciloci.Flee.Expression`1..ctor(String expression, ExpressionContext context, Boolean isGeneric) +713
Ciloci.Flee.ExpressionContext.CompileDynamic(String expression) +88
XXXXXSSFDM.Layouts.XXXXXSSFDM.EditPlantData.ValidateDataRow(List`1 rowDataList, SPGridViewRow gridViewRow, ExpressionContext expressionContext) +1171
XXXXXSSFDM.Layouts.XXXXXSSFDM.EditPlantData.ValidateData() +541
XXXXXSSFDM.Layouts.XXXXXSSFDM.EditPlantData.SaveData() +166
XXXXXSSFDM.Layouts.XXXXXSSFDM.EditPlantData.SaveButton_Click(Object sender, EventArgs e) +52
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +115
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +140
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +11070247
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +11069786
System.Web.UI.Page.ProcessRequest() +91
System.Web.UI.Page.ProcessRequest(HttpContext context) +240
ASP.EDITPlantDATA_ASPX__758514286.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\a225d0da\83ec41b8\App_Web_editPlantdata.aspx_-758514286.qeqss8gf.0.cs:0
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +599
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +171
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.5466; ASP.NET Version:2.0.50727.5456
This is occurring in Ciloci.Flee. I have the Flee VB.NET source code project included in my solution and the same target framework and snk are set.
However, if I change the Flee Deployment Target back to GAC then it runs fine. Some security I have overlooked somewhere but can't see it at the minute.
I am still getting to grips with SharePoint and ASP.NET. I don't know whether I need to look at some configuration in ASP.NET. I will still look for solutions - thought someone could point me in the right direction.