Medium Trust

Blake Niemyjski edited this page Aug 19, 2015 · 1 revision

Required updates to web.config file

You need to add requirePermission="false" to all sections below

<configSections>
    <section name="netTiersService" type="xxx.DAL.Bases.NetTiersServiceSection, xxx.DAL"
         allowDefinition="MachineToApplication" restartOnExternalChanges="true" requirePermission="false" />
    <section name="xxx.DAL" type="xxx.DAL.Bases.NetTiersServiceSection, xxx.DAL" allowDefinition="MachineToApplication"
         restartOnExternalChanges="true" requirePermission="false" />
    <section name="enterpriseLibrary.ConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection,
         Microsoft.Practices.EnterpriseLibrary.Common,  Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" />
<!--Required for WEB.UI controls to work in medium trust-->    
    <section name="xxx.DAL.SqlClient" type="xxx.DAL.SqlClient.Bases.NetTiersServiceSection, xxx.DAL.SqlClient"
         allowDefinition="MachineToApplication" restartOnExternalChanges="true" requirePermission="false" />
</configSections>

You also need to add the following to your project AssemblyInfo.cs file

[assembly: System.Security.SecurityRules(System.Security.SecurityRuleSet.Level1)]

For Medium trust enviroment, you may need to add requirePermission="false" in the entlib.config file

<configSections>
      <section name="securityConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Security.Configuration.SecuritySettings, 
                Microsoft.Practices.EnterpriseLibrary.Security, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
                requirePermission="false" />
      <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, 
                Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
                requirePermission="false" />
      <section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, 
                Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
                requirePermission="false" />
      <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, 
                Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
                requirePermission="false" />
      <section name="cachingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings, 
                Microsoft.Practices.EnterpriseLibrary.Caching, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
                requirePermission="false" />
</configSections>

To prevent time out problems in Integrated mode, add the following to entlib.config file.

<system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
      <!-- Start nettiers on IIS7.5 integrated mode-->
      <remove name="EntityTransactionModule"/>
      <add name="EntityTransactionModule" type="xxx.Data.EntityTransactionModule" />
</system.webServer>
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.