PDA

View Full Version : Execute codes that need low trust level on a server where thrust level is high


sujith
09-15-2007, 02:58 PM
I a using

System.Reflection
System.Runtime.InteropServices
System.Security.Permissions

In my web application
In this, Reflection need low thrust level to run
But I have hosted my site in a shared server.
So thrust level is high

I have tried to over ride the trust level by adding

<location allowOverride="true">
<securityPolicy>
<trustLevel name="Full" policyFile="internal" />
<trustLevel name="High" policyFile="web_hightrust.config" />
<trustLevel name="Medium" policyFile="web_mediumtrust.config" />
<trustLevel name="Low" policyFile="web_lowtrust.config" />
<trustLevel name="Minimal" policyFile="web_minimaltrust.config" />
</securityPolicy>
<trust level="Low" originUrl="http://192.166.1.82/xxx.com" />

</location>

In my applications web.config

Unfortunately this became impossible since the server administrator has

done <location allowOverride="false"> on
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\web.config
On the server


What can I do to execute codes that need low trust level
on a server where thrust level is high

CFMaBiSmAd
09-15-2007, 03:31 PM
It sounds like you are using my old Windows hosting company. :eek:

Because the Microsoft .NET framework does not play nice with anything else, not even other applications written in .net, and MS coders assumed you had your own server and never considered that you would want or be able to run a .net application in a shared hosting environment, unless you can eliminate the dependency on low/medium trust level, you will need to get your own VPS (Virtual Private Server) or a Dedicated server, where you can set the trust level to what you need, and not worry about any other .net applications than your own running on that server.

sujith
09-17-2007, 08:16 AM
http://cp.domainpaq.com/default.asp

my server is on this

sujith
09-28-2007, 09:14 AM
I solved it by



1)Download the latest version of Enterprise Library : http://www.microsoft.com/downloads/details.aspx?familyid=5a14e870-406b-4f2a-b723-97ba84ae80b5&displaylang=en
and install (by default, it will be installed under C:\Program Files\Microsoft Enterprise Library January 2006)


2)Download the patch to run EnterPriselibrary in Medium trust :
http://www.codeplex.com/entlib/Release/ProjectReleases.aspx?ReleaseId=1339


3)Replace the src and de unittests directories from the Enterprise library by the ones in the patch

4)run 2 batch files which come with the EntLib.
First, run BuildLibrary.bat, then CopyAssemblies.bat (both files are to be found in the same folder)

5)Replace the references in your webproject (Microsoft.Practices......dll) by the newly compiled under the enterprise library. Warning : all the dll's seem to be gathered in one bin directory under the enterprise library.


6)Change the web.config, add requirePermission="false" to the <section name="netTiersService" type="MySan.DataAccessL .... line (ignore the warning you will get about the non declared attribute)


7)Rebuild your webproject and publish ... it worked



A greate url is bellow http://community.codesmithtools.com/forums/p/4233/17397.aspx