Forums

Skip Navigation LinksHome / Developer Network / Forums / Sitefinity Older Versions (3.x): Deployment > Simulate in development environment medium trust

Simulate in development environment medium trust

  • Vangelis Intermediate avatar

    Posted on Apr 2, 2008 (permalink)

    Hi,

    Does anyone can post detailed instructions how to setup medium trust environment in development machine, just to simulate hosting providers running in this mode?

    This will help minimize errors before uploading project in production machine.

    I have found this in some other posts

    Set in the web.config:

    <system.web>
     <trust level="Medium" />


    Best regards

    Vagelis

    Reply

  • Nikifor Nikifor admin's avatar

    Posted on Apr 3, 2008 (permalink)

    Hello Vagelis,

    There are several steps which should be followed for setting your application to work in Medium Trust Environment. You could find them in the User Manual, section Medium Trust Support. Still, for your convenience, here are the steps you need to follow:

    Make the following changes in your web.config file:

    1. As mentioned in your post, the following script has to be added in the <system.web> tag:
    <system.web> 
      <trust level="Medium" /> 
      ... 
    <system.web>


    2. You have to make sure that the HealthMonitoring option is set to false:
    <healthMonitoring enabled="false" heartbeatInterval="0"


    3. You must make sure that you have not enabled Workflow for the modules or pages in any part of the web.config file:
    AllowPageWorkflow=”False” 
    AllowWorkflow=”False” 

    4. Make sure that the following line is commented out:
    <!--add name="SitefinityXml" securityProviderName="" type="Telerik.Lists.Data.XmlProvider, Telerik.Lists.Data" dataFile="~/App_Data/Lists.xml" visible="true" /--> 


    Please let us know if, after making all the adjustments described above, you still experience any of the issues for which you have reported to us.

    Best wishes,
    Nikifor
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center

    Reply

  • Josh avatar

    Posted on May 3, 2008 (permalink)

    I followed the above posted instructions as well, but when I run the site, I receive the permission error for system.reflection:

    System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.


    Is there anything I did incorrectly?

    Reply

  • Ivan Ivan admin's avatar

    Posted on May 14, 2008 (permalink)

    Hi Josh,

    Generally, servers allow RestrictedMemberAcces for ReflectionPermission while running in medium trust. In order to set up your local medium trust to allow ReflectionPermission, please do following:

    1. Navigate to root\windows\Microsoft.NET\Framework\2.x\CONFIG.
    2. Open the web_mediumtrust.config file.
    3. Make sure you have following line as a child of SecurityClasses:
    <SecurityClass Name="ReflectionPermission" Description="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> 
    4. Make sure you have following line among IPermission settings :
    <IPermission class="ReflectionPermission" version="1" Flags="RestrictedMemberAccess"/> 

    Save the file and try to run Sitefinity again. 

    Thank you for your patience and let us know if we can help you with anything else.

    Sincerely yours,
    Ivan
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center

    Reply

  • Posted on Aug 14, 2009 (permalink)

    The whold reason we need help to use medium trust is that we don't have access to the machine.config and want to run in a secure environment. Is there any way to setup sitefinity under these conditions. The main error so far I am seeing is file access against the web.config. File operations are a little more limited under medium trust.

    Any help would be greatly appreciated. I followed the steps without any success.

    Reply

  • Parvan Parvan admin's avatar

    Posted on Aug 17, 2009 (permalink)

    Hello jaime,

    Thank you for using our services.

    Yes - it is possible to setup Sitefinity in medium trust environment.

    1. It is important first to run the application in full trust (for example in your dev environment. This will generate the needed dll for Newsletter module.
    2. Set the medium trust and configure web.config file. Follow Nikifor's instructions.

    I hope this helps you.

    Sincerely yours,
    Parvan
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.

    Reply

  • Ali avatar

    Posted on Oct 22, 2009 (permalink)

    I am having no luck with the web.config fixes. I am even getting a new error when trying to add

    <trust level="Medium" /> 

    I get the following error:

    "Parser Error Message: This configuration section cannot be used at this path.  This happens when the site administrator has locked access to this section using <location allowOverride="false"> from an inherited configuration file."

    I have gone through and turned off all workflow sections, and I am running the community edition so the page workflow shouldn't have been enabled and I went through and changed everything to false as instructed.

    <providers> 
            <clear /> 
            <add connectionStringName="DefaultConnection" allowPageHistory="False" 
              allowPageWorkflow="False" name="Sitefinity" type="Telerik.Cms.Data.DefaultProvider, Telerik.Cms.Data" /> 
          </providers> 

    <add name="Generic_Content" urlRewriteFormat="[Publication_Date]/[Title].aspx" urlDateTimeFormat="yy-MM-dd" urlWhitespaceChar="_" visible="True" defaultMetaField="Name" securityProviderName="" allowLocalization="False" allowVersioning="True" allowWorkflow="False" allowComments="false" commentsModeration="true" versioningProviderName="" connectionStringName="GenericContentConnection" type="Telerik.Cms.Engine.Data.Providers.DefaultProvider, Telerik.Cms.Engine.Data"/> 
            <add name="News" urlRewriteFormat="[Publication_Date]/[Title].aspx" urlDateTimeFormat="yy-MM-dd" urlWhitespaceChar="_" visible="False" defaultMetaField="Title" securityProviderName="" allowVersioning="True" applicationName="/News" versioningProviderName="" commentsModeration="true" connectionStringName="GenericContentConnection" type="Telerik.News.Data.DefaultNewsProvider, Telerik.News.Data" /> 
            <add name="Blogs" urlRewriteFormat="[Publication_Date]/[Title].aspx" urlDateTimeFormat="yy-MM-dd" urlWhitespaceChar="_" visible="False" defaultMetaField="Title" applicationName="/Blogs" allowVersioning="True" allowLocalization="False" localizationProviderName="" allowWorkflow="False" securityProviderName="" versioningProviderName="" connectionStringName="GenericContentConnection" type="Telerik.Blogs.Data.DefaultBlogProvider, Telerik.Blogs.Data"/> 
            <add name="Libraries" urlRewriteFormat="~/{Provider}/{LibraryName}/[Name].sflb" urlDateTimeFormat="yy-MM-dd" urlWhitespaceChar="_" visible="False" defaultMetaField="Name" applicationName="/Libraries" allowVersioning="True" allowLocalization="False" localizationProviderName="" allowWorkflow="False" securityProviderName="" versioningProviderName="" connectionStringName="GenericContentConnection" type="Telerik.Libraries.Data.DefaultProvider, Telerik.Libraries.Data" tagEditorTemplate="~/Sitefinity/Admin/ControlTemplates/Libraries/BatchTagsEditor.ascx"/> 

    I am at a loss. I have attached an image for reference of the error.

    What else can be done?
    Attached files

    Reply

  • Ivan Dimitrov Ivan Dimitrov admin's avatar

    Posted on Oct 22, 2009 (permalink)

    Hello Ali,

    The error is pretty clear - your host does not allow specifying and setting the connection string through user's web.config file. By default the server runs in medium trust, so that you do no have to specify the level. If you remove this node from your web.config file the error should disappear.
    As  for the medium trust you should also disable the HealthMonitoring - it is not supported in medium trust.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.

    Reply

  • Posted on Oct 22, 2009 (permalink)

    I would suggest one thing. In your development environment you should add the trust element to medium. On the server however, since it will have been set to medium in the server machine.config, you should remove that element altogether.

    When I had the trust element in the server web.config I still got the security exception when it was set to Level=Medium. Once I removed the <trust Level=Medium /> it worked fine. It could be the way that medium trust security was implemented in the web.config checks to make sure no one is trying to override and lower the trust via the trust element. I don't know if that is a microsoft oversight or a hack in place on the server in my case but that helped me. 

    Therefore, use the <trust Level=Medium /> is only to make sure that the application functions on your dev machine properly under medium trust conditions.

    Reply

  • Ali avatar

    Posted on Oct 23, 2009 (permalink)

    Health monitoring is turned off and i have removed the trust section as well. I am still getting this error [See: Attached]

    Sorry for my ignorance.
    Attached files

    Reply

  • Ivan Dimitrov Ivan Dimitrov admin's avatar

    Posted on Oct 23, 2009 (permalink)

    Hi Ali,

    It seems that your host does not support the default configuration for Medium Trust level and Sitefinity's providers cannot be initialized.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.

    Reply

  • Albin Malmgren avatar

    Posted on Oct 23, 2009 (permalink)

    Hi, I have same problem as Ali and I hope for some solution. I  don't now how to solve this? I've followed the steps above and still get this:


    [SecurityException: That assembly does not allow partially trusted callers.]   Nolics.ORMapper.DataProviders.SQLDataProvider.Open() +123   Telerik.DataAccess.NolicsHelper.SetConnection(String connectionName, String providerName) +830   Telerik.Cms.Data.DefaultProvider.Initialize(String name, NameValueCollection config) +214   Telerik.ManagerBase`1.InstantiateProvider(ProviderSettings providerSettings, Type providerType) +673   Telerik.ManagerBase`1.InstantiateProvider(ProviderSettings providerSettings) +91   Telerik.ManagerBase`1.SetProvider(String providerName) +203   Telerik.ManagerBase`1..ctor(String providerName) +89   Telerik.ManagerBase`1..ctor() +11   Telerik.Cms.Web.UrlHelper.Initialize(CmsHttpModule cmsModule) +38   Telerik.Cms.Web.CmsHttpModule.Init(HttpApplication context) +86   System.Web.HttpApplication.InitModulesCommon() +65   System.Web.HttpApplication.InitModules() +43   System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +729   System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +298   System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +107   System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +289
    My hostprovider run this medium trust config.
    http://wiki.binero.se/Programmering/Sidans_titel#Hur_ser_er_Medium_Trust-konfiguration_ut.3f
    Any ideas? 

    Reply

  • Ivan Dimitrov Ivan Dimitrov admin's avatar

    Posted on Oct 28, 2009 (permalink)

    Hello Albin Malmgren,

    The configuration seems to be correct, but there should be something else that blocks the initializing of the providers. I suggest that you should try one of your host partners where Sitefinity will run without problems.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.

    Reply

  • Mehdi avatar

    Posted on Nov 18, 2009 (permalink)

    here is a link for Sitefinity running on shared hosting with medium trust
    http://mehdimirza.blogspot.com/2009/11/installing-sitefinity-on-shared-hosting.html

    Thanks

    Mehdi

    Reply

  • Register for webinar
Skip Navigation LinksHome / Developer Network / Forums / Sitefinity Older Versions (3.x): Deployment > Simulate in development environment medium trust