My 4.0 MVC app that renders a PDF View to screen. It all works on my dev box but generates a security violation from the host provider environment. To compensate, I added [AllowPartiallyTrustedCallers] and [SecurityCritical] attributes on controller. Only now, two of my nuget packages will not compile because they are not strong name compliant. So when I try the following steps to make them strongly named, I end up with a runtime error. Any suggestions appreciated.
Steps to strong name nuget dlls.
1) ldasm /all /out=Rotativa.il Rotativa.dll
2) sn -k Rotativa.snk
3) ilasm /dll /key=Rotativa.snk Rotativa.il
Runtime Error: {"Attempt by security transparent method 'my_App. M v c Application. Application_Start()' to access security critical method 'System.Web.Optimization.Bundle Table.get_Bundles()' failed.\n\n Assembly 'my_App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is marked with the 'Allow Partially Trusted Callers Attribute', and uses the level 2 security transparency model. Level 2 transparency causes all methods in 'Allow Partially Trusted Callers Attribute'assemblies to become security transparent by default, which may be the cause of this exception."}
Attempt by security transparent method 'my_App. M v c Application.Application_Start()' to access security critical method 'System.Web.Optimization.Bundle Table.get_Bundles()' failed.
Assembly 'my_App, Version=1.0.0.0, Culture=neutral, Public Key Token=null' is marked with the 'Allow Partially Trusted Callers Attribute', and uses the level 2 security transparency model. Level 2 transparency causes all methods in 'Allow Partially Trusted Callers' assemblies to become security transparent by default, which may be the cause of this exception.
Have you already executed the .NET Security Annotator Tool on your assembliy and its dependencies? It guides you through the steps to make it Level 2 compliant.
http://msdn.microsoft.com/en-us/library/dd997356.aspx