How to debug security exceptions. No Dll refrence /line number is included in error stack. Asp.net c#

A site which was using net 2.0 was upgraded to 4.0. After updating it is throwing Security Exception. The problematic part is I am unable to infer the Dll/method that is causing this very problem.
When I remove all dll it starts to throw missing dll error. Uploading dll one by one solves the problem, however the problem reoccur when the app pool is recycled. I have seen this behavior with Rackspace cloud hosting.

Please tell how should I proceed with only the following information or how can I collect more information / or pin point the actual problem.

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 failed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SecurityException: Request failed.]
System.Security.CodeAccessSecurityEngine.ThrowSecurityException(RuntimeAssembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandleInternal rmh, SecurityAction action, Object demand, IPermission permThatFailed) +166
System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object assemblyOrString, PermissionSet granted, PermissionSet refused, RuntimeMethodHandleInternal rmh, SecurityAction action, Object demand, IPermission permThatFailed) +100
System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandleInternal rmh, Object assemblyOrString, SecurityAction action, Boolean throwException) +272
System.Security.CodeAccessSecurityEngine.CheckSetHelper(CompressedStack cs, PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandleInternal rmh, RuntimeAssembly asm, SecurityAction action) +55
System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes) +0
System.Reflection.RuntimeAssembly.GetExportedTypes() +21
System.Web.Compilation.WCFModel.VSWCFServiceContractGenerator.LoadSharedDataContractTypes(ClientOptions proxyOptions, IContractGeneratorReferenceTypeLoader typeLoader, Int32 targetFrameworkVersion, IList1 importErrors) +275
System.Web.Compilation.WCFModel.VSWCFServiceContractGenerator.CreateDataContractImporter(ClientOptions proxyOptions, CodeCompileUnit targetCompileUnit, CodeDomProvider codeDomProvider, String proxyNamespace, IContractGeneratorReferenceTypeLoader typeLoader, Int32 targetFrameworkVersion, IList
1 importErrors) +200
System.Web.Compilation.WCFModel.VSWCFServiceContractGenerator.CreateWsdlImporter(SvcMapFile svcMapFile, Configuration toolConfiguration, CodeCompileUnit targetCompileUnit, CodeDomProvider codeDomProvider, String targetNamespace, IServiceProvider serviceProviderForImportExtensions, IContractGeneratorReferenceTypeLoader typeLoader, Int32 targetFrameworkVersion, IList`1 importErrors, Type typedDataSetSchemaImporterExtension) +517
System.Web.Compilation.WCFModel.VSWCFServiceContractGenerator.GenerateCodeAndConfiguration(SvcMapFile svcMapFile, Configuration toolConfiguration, CodeDomProvider codeDomProvider, String proxyNamespace, Configuration targetConfiguration, String configurationNamespace, IServiceProvider serviceProviderForImportExtensions, IContractGeneratorReferenceTypeLoader typeLoader, Int32 targetFrameworkVersion, Type typedDataSetSchemaImporterExtension) +228
System.Web.Compilation.WCFBuildProvider.GenerateCodeFromServiceMapFile(String mapFilePath) +216

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34248


Source: dll

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.