Question

I have a default ASP.NET Web Site template project that I created with VS2012. I'm trying to publish it to 1and1.com where only Medium trust is allowed. Apparently, this template expects Full trust, but I can't figure out what I need to do.

The error I'm getting is...

    [SecurityException: Request for the permission of type 'System.Security.Permissions.TypeDescriptorPermission, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
   System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
   System.Security.CodeAccessSecurityEngine.Check(PermissionSet permSet, StackCrawlMark& stackMark) +31
   System.Security.PermissionSet.Demand() +68
   System.ComponentModel.TypeDescriptor.AddProviderTransparent(TypeDescriptionProvider provider, Type type) +153
   System.Web.DynamicData.MetaModel.CreateSimpleModel(Type entityType) +77
   System.Web.DynamicData.MetaTable.CreateTable(Type entityType) +9
   System.Web.UI.DataControlExtensions.GetTableFromCache(Type entityType) +64
   System.Web.UI.DataControlExtensions.EnableDynamicData(INamingContainer control, Type entityType) +14
Was it helpful?

Solution

From the stacktrace I infer you're using DynamicData in your website, and you said you're using the Web Site template in Visual Studio.

There are a couple of issues with that, but you can try a couple of things:

1: Don't use the Web Site template, but the Web Application template

or

2: Precompile the Website before deploying

or

3: Move the edmx file from the App_Code directory to a seperate library, compile it and add the resulting .dll to the websites bin folder.

Here and here you can find more info about this problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top