Simulating Shared Hosting Trust Levels
Asked Answered
L

2

7

I want to simulate the trust levels of a shared hosting environment on my development machine so that there are no nasty surprises when I come to deploy my solution.

I added this my setting the web.config:

<trust level="Medium" originUrl="*"/>

The only problem with this is that I'm getting this exception when I try to save to my database:

InnerException: System.Security.SecurityException Message="Request for the permission of type 'System.Net.SocketPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed." Source="mscorlib"

How do I specifically allow this while still maintaining medium 'like' trust. Are there other things I can resonably allow?. Ill be hosting on GoDaddy.

Latvian answered 28/3, 2009 at 22:1 Comment(0)
L
5

I contacted Godaddy, and got this responce:

GoDaddy.com ASP.NET shared hosting servers use the default Medium trust level with the addition of OleDbPermission, OdbcPermission, and a less-restrictive WebPermission.

Applications operating under a Medium trust level have no registry access, no access to the Windows event log, and cannot use reflection. Such applications can communicate only with a defined range of network addresses and file system access is limited to the application's virtual directory hierarchy. Please make sure that your application can work in a Medium trust environment if you are having any problems with it.

So people can use this as an indication of what shared hosting permissions are generally like.

When I figure out how to create these permissions as outlined in @blowdards link ill post them. Or if anyone could post an example that would be great.

Latvian answered 30/3, 2009 at 17:35 Comment(0)
C
0

So what you have is the default medium trust, and the error you are seeing is right.

Of course the server admin can adjust this all they like, you just need to find out exactly what changes they made to the default trust policy. You can create a custom trust level by following the steps outlined on MSDN. Now all you need to do is find out exactly what godaddy has done to theirs :)

Corrugation answered 29/3, 2009 at 14:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.