An error occurs when calling a WCF call. The error message is as follows:
<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 istrustedwithoutapchloroform) </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 istrustedwithoutapchloroform)
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 [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>
The main reason is that I copied a copy of the program from another machine and deployed it on this machine. Some permissions may follow after the copy.
Solution settings
1: Set the identity of the process model of the application connection pool. The default value is applicationpoolidentity. Change to NetworkService
To:
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 exception