I am trying to use the Entity Framework in an ASP.NET application hosted at GoDaddy. I keep receiving the following error:
============================================== 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: System.Security.Permissions.SecurityPermission [SecurityException: System.Security.Permissions.SecurityPermission] EntityBid.Trace(String fmtPrintfW, String a1) +0 System.Data.EntityUtil.InvalidSchemaEncountered(String errors) +172 System.Data.Metadata.Edm.EdmItemCollection.LoadItems(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths, SchemaDataModelOption dataModelOption, DbProviderManifest providerManifest, ItemCollection itemCollection, Boolean throwOnError) +232 System.Data.Metadata.Edm.EdmItemCollection..ctor(IEnumerable`1 xmlReaders, IEnumerable`1 filePaths) +167 System.Data.Metadata.Edm.EdmMetadataEntry.LoadEdmItemCollection (MetadataArtifactLoader loader) +75 System.Data.Metadata.Edm.EdmItemCollectionLoader.LoadItemCollection (EdmMetadataEntry entry) +13 System.Data.Metadata.Edm.MetadataCache.LoadItemCollection (IItemCollectionLoader`1 itemCollectionLoader, T entry) +114 System.Data.Metadata.Edm.MetadataCache.GetOrCreateEdmItemCollection (String cacheKey, MetadataArtifactLoader loader, Object& entryToken) +133 System.Data.EntityClient.EntityConnection.LoadEdmItemCollection (MetadataWorkspace workspace, MetadataArtifactLoader artifactLoader) +51 System.Data.EntityClient.EntityConnection.GetMetadataWorkspace (Boolean initializeAllCollections) +161 System.Data.Objects.ObjectContext.RetrieveMetadataWorkspaceFromConnection () +19 System.Data.Objects.ObjectContext..ctor(EntityConnection connection, Boolean isConnectionConstructor) +144 System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName) +197 GabbiCat.BusinessLogic.GabbiCatEntities..ctor() in GabbiCatDataModel.Designer.cs:26 GabbiCat.BusinessLogic.UserManager.CreateUserRecord(String phoneNumber, UserStatus status, DateTime birthdate, String recordedNameId) in UserManager.cs:265 GabbiCat.BusinessLogic.UserManager.CreateUser(String phoneNumber, DateTime birthdate, Byte[] recordedName) in UserManager.cs:86 CreateUser.btnCreateUser_Click(Object sender, EventArgs e) +369 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent (String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +7350 System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +213 System.Web.UI.Page.ProcessRequest() +86 System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18 System.Web.UI.Page.ProcessRequest(HttpContext context) +49 ASP.createuser_aspx.ProcessRequest(HttpContext context) +4 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute () +358 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64 =========================================== It's my understanding that GoDaddy is a "Medium Trust" environment, and some posts I've found indicate that this is the problem. However, other posts, like the ones below, seem to imply Entity Framework should work within a medium trust environment. http://www.aspnetpro.com/newsletterarticle/2008/08/asp200808dk_l/asp200808dk_l.asp http://forums.asp.net/t/1290380.aspx http://support.microsoft.com/kb/958975 I have my edmx in a separate class library as recommended and have removed the edmx buildprovider from the web.config, but still the same error. Any suggestions would be greatly appreciated. Thanks.
