码迷,mamicode.com
首页 > 其他好文 > 详细

Request for the permission of type异常

时间:2014-09-18 23:38:54      阅读:321      评论:0      收藏:0      [点我收藏+]

标签:blog   http   io   os   ar   for   2014   sp   cti   

调用wcf调用的时候引发一个错误,错误信息如下:

<Message>Request for the permission of type ‘System.Configuration.ConfigurationPermission, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a‘ failed.</Message>

<StackTrace> at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark&amp; stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
at System.Configuration.BaseConfigurationRecord.CheckPermissionAllowed(String configKey, Boolean requirePermission, Boolean isTrustedWithoutAptca)</StackTrace>
<Type>System.Security.SecurityException</Type>
</InnerException>
<Message>Request for ConfigurationPermission failed while attempting to access configuration section ‘dataConfiguration‘. To allow all callers to access the data for this section, set section attribute ‘requirePermission‘ equal ‘false‘ in the configuration file where this section is declared.</Message>
<StackTrace> at System.Configuration.BaseConfigurationRecord.CheckPermissionAllowed(String configKey, Boolean requirePermission, Boolean isTrustedWithoutAptca)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object&amp; result, Object&amp; resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
at System.Web.Configuration.HttpConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String configKey)
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.SystemConfigurationSourceImplementation.GetSection(String sectionName)
at Microsoft.Practices.EnterpriseLibrary.Data.DatabaseConfigurationView.GetProviderMapping(String name, String dbProviderName)
at Microsoft.Practices.EnterpriseLibrary.Data.DatabaseCustomFactory.CreateObject(IBuilderContext context, String name, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.ConfiguredObjectStrategy.PreBuildUp(IBuilderContext context)
at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)</StackTrace>
<Type>System.Security.SecurityException</Type>
</InnerException>
<Message>The current build operation (build key Build Key[Microsoft.Practices.EnterpriseLibrary.Data.Database, MACProvider]) failed: Request for ConfigurationPermission failed while attempting to access configuration section ‘dataConfiguration‘. To allow all callers to access the data for this section, set section attribute ‘requirePermission‘ equal ‘false‘ in the configuration file where this section is declared. (Strategy type ConfiguredObjectStrategy, index 2)</Message>
<StackTrace> at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)
at Microsoft.Practices.ObjectBuilder2.Builder.BuildUp(IReadWriteLocator locator, ILifetimeContainer lifetime, IPolicyList policies, IStrategyChain strategies, Object buildKey, Object existing)
at Microsoft.Practices.ObjectBuilder2.Builder.BuildUp[TTypeToBuild](IReadWriteLocator locator, ILifetimeContainer lifetime, IPolicyList policies, IStrategyChain strategies, Object buildKey, Object existing)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory.BuildUp[T](IReadWriteLocator locator, ILifetimeContainer lifetimeContainer, String id, IConfigurationSource configurationSource)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory.BuildUp[T](String id, IConfigurationSource configurationSource)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.NameTypeFactoryBase`1.Create(String name)
at Microsoft.Practices.EnterpriseLibrary.Data.DatabaseFactory.CreateDatabase(String name)
at ABC.AC.WebServices.FileTransport.BusinessLogicLayer.Impelementation.BaseBLLController.CreateDB(String dbName)
at ABC.AC.WebServices.FileTransport.BusinessLogicLayer.Impelementation.MACBLLController..ctor()
at ABC.AC.WebServices.FileTransport.ServiceLayer.FileTransportService.MTenantController..cctor() in F:\Loyalty\Phase3\WebServices\FileTransport\ServiceLayer\FileTransportService\Controller.cs:line 153</StackTrace>
<Type>Microsoft.Practices.ObjectBuilder2.BuildFailedException</Type>
</InnerException>
<Message>The type initializer for ‘ABC.AC.WebServices.FileTransport.ServiceLayer.FileTransportService.MTenantController‘ threw an exception.</Message>
<StackTrace> at ABC.AC.WebServices.FileTransport.ServiceLayer.FileTransportService.MTenantController.SynchronizeLYBMerchant(String tenantCode, Nullable`1 lastSynchronizeTime)
at ABC.AC.WebServices.FileTransport.ServiceLayer.FileTransportService.CommonService.SynchronizeLYBMerchant(String tenantCode, Nullable`1 lastSynchronizeTime) in F:\Loyalty\Phase3\WebServices\FileTransport\ServiceLayer\FileTransportService\CommonService.cs:line 744
at ABC.AC.WebServices.FileTransport.ServiceLayer.FileTransportService.DataSynchronizService.GetMerchant(String tenantCode, Nullable`1 lastSynchronizeTime) in F:\Loyalty\Phase3\WebServices\FileTransport\ServiceLayer\FileTransportService\DataSynchronizeService.cs:line 25
at SyncInvokeGetMerchant(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]&amp; outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp; rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp; rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc&amp; rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace>
<Type>System.TypeInitializationException</Type>

 

 

主要原因是我从另外的机器复制了一份程序部署到这台机器上,在复制过来可能有些权限也跟着过来了。

解决方法设置
1:设置应用连接池的 process model的Identity.  缺省是ApplicationPoolIdentity。 修改为 Networkservice

bubuko.com,布布扣

 

 

 

转:

http://blogs.msdn.com/b/friis/archive/2010/06/09/system-security-securityexception-request-for-the-permission-of-type-system-web-aspnethostingpermission-failed.aspx

 

Request for the permission of type异常

标签:blog   http   io   os   ar   for   2014   sp   cti   

原文地址:http://www.cnblogs.com/BinZeng/p/3980208.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!