2

I have created a MVC 3 WCF Rest project using the tutorial described here. The only problem is that am able to run the project and access the rest api when the application is running at high trust level but when i change the trust level to medium i get the following when i access the service

[SecurityException: Request for the permission of type 'System.Configuration.ConfigurationPermission, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed.]
   System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
   System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission cap, StackCrawlMark& stackMark) +31
   System.Security.CodeAccessPermission.Demand() +46
   System.ServiceModel.Description.ConfigLoader.CheckAccess(IConfigurationContextProviderInternal element) +12116253
   System.ServiceModel.Description.ConfigLoader.LookupServiceBehaviors(String behaviorName, ContextInformation context) +12238226
   System.ServiceModel.Description.ConfigLoader.LoadServiceDescription(ServiceHostBase host, ServiceDescription description, ServiceElement serviceElement, Action`1 addBaseAddress) +137
   System.ServiceModel.ServiceHostBase.LoadConfigurationSectionInternal(ConfigLoader configLoader, ServiceDescription description, ServiceElement serviceSection) +67
   System.ServiceModel.ServiceHostBase.ApplyConfiguration() +108
   System.ServiceModel.ServiceHostBase.InitializeDescription(UriSchemeKeyedCollection baseAddresses) +192
   System.ServiceModel.ServiceHost.InitializeDescription(Type serviceType, UriSchemeKeyedCollection baseAddresses) +49
   System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses) +151
   Microsoft.ApplicationServer.Http.HttpServiceHost..ctor(Type serviceType, Uri[] baseAddresses) +63
   Microsoft.ApplicationServer.Http.Activation.HttpConfigurableServiceHost..ctor(Type serviceType, IHttpHostConfigurationBuilder builder, Uri[] baseAddresses) +40
   Microsoft.ApplicationServer.Http.Activation.HttpConfigurableServiceHostFactory.CreateServiceHost(Type serviceType, Uri[] baseAddresses) +79
   System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +420
   System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath) +1440
   System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +44
   System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +615

Please Help.. any ideas on how to solve this

carlosfigueira
  • 85,035
  • 14
  • 131
  • 171

1 Answers1

0

The Web API project currently doesn't work in partial trust. PT support is planned, but it hasn't been implemented yet.

carlosfigueira
  • 85,035
  • 14
  • 131
  • 171