SharpCrafters Forum – System.Security.SecurityException: AspNetHostingPermission

SharpCrafters Support Forum

        


System.Security.SecurityException:... Expand / Collapse
Author
Message
Posted 3/11/2010 11:57:19 PM


Charles Meyer

Community Member
I get the following error when I compile my code:

ERROR  in C:\Program Files (x86)\PostSharp 1.5\PostSharp-1.5.targets(261,5) : Unhandled exception: System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
    at System.ModuleHandle.ResolveMethod(Int32 methodToken, RuntimeTypeHandle* typeInstArgs, Int32 typeInstCount, RuntimeTypeHandle* methodInstArgs, Int32 methodInstCount)
    at System.ModuleHandle.ResolveMethodHandle(Int32 methodToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
    at System.Reflection.Module.ResolveMethod(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
    at PostSharp.CodeModel.MethodDefDeclaration.GetSystemMethod(Type[] genericTypeArguments, Type[] genericMethodArguments, BindingOptions bindingOptions)
    at PostSharp.Laos.Weaver.MethodLevelAspectWeaver.Initialize()
    at PostSharp.Laos.Weaver.OnMethodBoundaryAspectWeaver.Initialize()
    at PostSharp.Laos.Weaver.LaosTask.Execute()
    at PostSharp.Extensibility.Project.ExecutePhase(String phase)
    at PostSharp.Extensibility.Project.Execute()
    at PostSharp.Extensibility.PostSharpObject.ExecuteProjects()
    at PostSharp.Extensibility.PostSharpObject.InvokeProject(ProjectInvocation projectInvocation)
    at PostSharp.MSBuild.PostSharpRemoteTask.Execute(PostSharpTaskParameters parameters, TaskLoggingHelper log)

This is a web application project and using Visual Studio 2008 via the command line tool (build script). The build system is running Windows 2008 (64 bit). Any thoughts?

*** UPDATE***

This appears to only happen if the compilation is done via MSBuild, but if built using Visual Studio, it works fine.
Post #4150
Posted 3/12/2010 10:19:14 AM


Gael Fraiteur

SharpCrafters
That's really weird. Never seen that in 5 years.

I suspect you're running PostSharp from a non-trusted location (such as a network share). Is it possible?

-gael
Post #4152
Posted 4/14/2010 1:24:06 AM


Charles Meyer

Community Member
No, we are NOT executing it from a network share. We are running it through MSBuild via Team Foundation Server build process on a Windows 2008 64 bit server. It doesn't make sense, because if I open the project on that same server and build it via the IDE, it builds fine, without any errors/warnings. Also, it only does this when it is building a Web Application project. If I build a class library project, it works fine.

Weird, huh? 
Post #4365
Posted 4/14/2010 8:39:42 AM


Gael Fraiteur

SharpCrafters
What if you force PostSharp to run out-of-process by defining the MSBuild property "PostSharpUseCommandLine=True" in your project?
Post #4370
« Prev Topic | Next Topic »


All times are GMT +1:00, Time now is 11:44am

Powered By InstantForum.NET v4.1.4 © 2010
Execution: 0.220. 8 queries. Compression Disabled.