I am getting a SecurityException (as seen below), even with [assembly: AllowPartiallyTrustedCallers] in my AssemblyInfo.cs.
I am deploying to GoDaddy, which is a medium trust environment, which I don't think StructureMap is set up to run under natively, although the 2.5.3 release notes mention adding the AllowPartiallyTrustedCallers attribute on the assembly level, it doesn't seem to correct the issue.
Is there a code example or something that will point me in the right direction? What am I missing?
I am simulating medium trust locally with the following in my web.config
<system.web>
<trust level="Medium" />
</system.web>
Below is the exception stack.
[SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, 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() +59
System.IO.Directory.GetCurrentDirectory() +182
System.Reflection.Emit.AssemblyBuilderData..ctor(Assembly assembly, String strAssemblyName, AssemblyBuilderAccess access, String dir) +1698440
System.AppDomain.InternalDefineDynamicAssembly(AssemblyName name, AssemblyBuilderAccess access, String dir, Evidence evidence, PermissionSet requiredPermissions, PermissionSet optionalPermissions, PermissionSet refusedPermissions, StackCrawlMark& stackMark, IEnumerable`1 unsafeAssemblyAttributes) +327
System.AppDomain.DefineDynamicAssembly(AssemblyName name, AssemblyBuilderAccess access) +38
StructureMap.Emitting.DynamicAssembly.Init() +184
StructureMap.Emitting.InstanceBuilderAssembly..ctor(IEnumerable`1 plugins) +141
StructureMap.Graph.PluginCache.createAndStoreBuilders(IEnumerable`1 plugins) +25
StructureMap.Graph.PluginCache.Compile() +125
StructureMap.Container.construct(PluginGraph pluginGraph) +118
StructureMap.Configuration.GraphBuilder..ctor(Registry[] registries, PluginGraph pluginGraph) +190
StructureMap.PluginGraphBuilder.Build() +50
StructureMap.ConfigurationExpression.BuildGraph() +103
StructureMap.ObjectFactory.Initialize(Action`1 action) +102
JonEricksonMVC.Library.Bootstrapper.ConfigureStructureMap() +66
JonEricksonMVC.MvcApplication.Application_Start() +19
-
That is from an issue with StructureMap and partially trusted callers. The same issue was reported in the group and the blog.
Have you updated to the latest version? The release notes for 2.5.3 mention some AllowPartiallyTrustedCallers fixes.
Jon Erickson : I am on the latest version, so I'll go check this out. thanks!jesperlind : I got the same problem. I have tried the latest build from svn but no luck. Any solutions?Jon Erickson : no solution yet, i am still actively looking for one. -
It appears that this situation is caused by using Reflection which you can not do with GoDaddy hosting, thanks to their Medium Trust requirements.
I would recommend you move your hosting away from GoDaddy. Maybe DiscountASP.net would work well for you.
-
Have you got any solution? I am facing the same problem with structuremap2.5.3 implementation.It is asking me for the full trust but it is not possible on sheared hosting
Pankaj : hey dude, i had create my own dependency injection, It is working with NHibernate on Godaddy.
0 comments:
Post a Comment