web-application hosting on GoDady with medium trust

Posts   
 
    
mohamed avatar
mohamed
User
Posts: 136
Joined: 10-Mar-2008
# Posted on: 22-Nov-2008 17:22:35   

Greeting,

LLBLv2.5, .NET3.5, VS2008, Webforms application

I am trying to host this web-application on GoDady but they are telling me that they host .NET application based on .NET2.x and 3.x on medium trust and not full trust (only .NET1.x is hoted at full trust).

Whenever I try to browse the application I get a security error in the browser. Any advice on how to solve this predicament??

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
mohamed avatar
mohamed
User
Posts: 136
Joined: 10-Mar-2008
# Posted on: 23-Nov-2008 19:28:00   

Hi dealmo, I did requirePermission=false but still gives exception

Security Exception Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request failed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SecurityException: Request failed.] System.Reflection.CustomAttribute._CreateCaObject(Void* pModule, Void* pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs) +0 System.Reflection.CustomAttribute.CreateCaObject(Module module, RuntimeMethodHandle ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs) +104 System.Reflection.CustomAttribute.GetCustomAttributes(Module decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes) +490 System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit) +258 System.RuntimeType.GetCustomAttributes(Type attributeType, Boolean inherit) +63 System.ComponentModel.ReflectTypeDescriptionProvider.ReflectGetAttributes(Type type) +262 System.ComponentModel.ReflectedTypeData.GetAttributes() +64 System.ComponentModel.DefaultTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetAttributes() +50 System.ComponentModel.TypeDescriptor.GetAttributes(Type componentType) +26 System.ComponentModel.ReflectedTypeData.GetConverter(Object instance) +168 System.ComponentModel.DefaultTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetConverter() +55 System.ComponentModel.TypeDescriptor.GetConverter(Type type) +17 System.Web.UI.ObjectStateFormatter.SerializeValue(SerializerBinaryWriter writer, Object value) +2369


Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 23-Nov-2008 19:45:20   

Did you also try these? http://llblgen.com/TinyForum/Messages.aspx?ThreadID=8759&StartAtMessage=0&#48442 [http://llblgen.com/TinyForum/Messages.aspx?ThreadID=13009&StartAtMessage=0&#72330](http://llblgen.com/TinyForum/Messages.aspx?ThreadID=13009&StartAtMessage=0&#72330) (Walaa: Helpdesk thread)

David Elizondo | LLBLGen Support Team
mohamed avatar
mohamed
User
Posts: 136
Joined: 10-Mar-2008
# Posted on: 23-Nov-2008 22:21:33   

Hi Dealmo,

I added [assembly: AllowPartiallyTrustedCallers()]" in AssemblyInfo to my generated DAL that contain generated class from deigner and still Exception and download last runtime library I'm use LLBL v2.5 AdapterMode with .Net 3.5

this is web site hosted at GoDady

http://www.nilecon.com/

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 24-Nov-2008 09:32:56   

Now your site is showing the following exception:

Could not load file or assembly 'SOOQ.Web' or one of its dependencies. The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)

That's another issue and most probably has nothing to do with LLBLGen Pro.

At least make sure you are using the latest build of v2.5 of LLBLGen runtime library.

mohamed avatar
mohamed
User
Posts: 136
Joined: 10-Mar-2008
# Posted on: 24-Nov-2008 11:17:18   

Sorry Walaa, maybe you fire website during putting updates i did some update to solve security issue and still got error

I added [assembly: AllowPartiallyTrustedCallers()]" in AssemblyInfo to my generated DAL that contain generated class from designer and still Exception and in my web project and download last runtime library 10-16-2008

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 24-Nov-2008 15:57:45   

I guess if it was about partially trusted callers most probably the exception would be:

System.Security.SecurityException: That assembly does not allow partially trusted callers

Maybe you need to try this, although I'm not sure it's the same issue: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=13134

mohamed avatar
mohamed
User
Posts: 136
Joined: 10-Mar-2008
# Posted on: 24-Nov-2008 16:11:59   

I do following

Replace LLBL datasource with sqldatasource and worked Although using "SD.LLBLGen.Pro.ORMSupportClasses" in their cs file

but when register assembly in web-form that throw exception


<%@ Register assembly="SD.LLBLGen.Pro.ORMSupportClasses.NET20" namespace="SD.LLBLGen.Pro.ORMSupportClasses" tagprefix="llblgenpro" %>


Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 24-Nov-2008 16:15:53   

Did you try the trick of requirePermission="false", which was mentioned in the link I've posted?

omar avatar
omar
User
Posts: 569
Joined: 15-Oct-2004
# Posted on: 24-Nov-2008 19:39:45   

Walaa... I am having the same issue with GoDaddy. I dont know exactly how to add this tag to the webConfig. Is this tag to reference the LLBLDataSource or what??

The link you are referencing also doe not have an example of the tag

omar avatar
omar
User
Posts: 569
Joined: 15-Oct-2004
# Posted on: 24-Nov-2008 19:56:25   

I have been reading through some of the related threads. The following thread http://llblgen.com/TinyForum/Messages.aspx?ThreadID=8759 has the same issue as Magdi and myself are having. I also dont get the error when not using the LLBLDataSOurce?!!!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39859
Joined: 17-Aug-2003
# Posted on: 24-Nov-2008 21:19:08   

The ORMSupportClasses assembly is marked as an assembly to be run in partial trust. I think godaddy has the security settings set to a stricter level than partial trust, can you verify that with godaddy?

Frans Bouma | Lead developer LLBLGen Pro
mohamed avatar
mohamed
User
Posts: 136
Joined: 10-Mar-2008
# Posted on: 24-Nov-2008 21:55:55   

godady told me that

GoDaddy.com shared hosting servers using ASP.NET 2.0 and higher versions 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

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 25-Nov-2008 11:19:55   

You get the exception when the viewstate is produced, which apparently uses reflection according to the exception. We are not sure why. You could try to use fastserialization IF you are using the adapter, see if that helps, but I'm not sure if that will work. Reflection on public members should always work, so I'm not sure if Godaddy has fiddled with this setting to switch it off completely. The exception stacktrace clearly shows it's dying inside ASP.NET code, not our code.

Reading the following link, it makes me think there is nothing to do about it. http://www.gavaghan.org/blog/2007/08/21/nhibernate-in-a-medium-trust-environment

Omar wrote:

I also dont get the error when not using the LLBLDataSOurce?!!!

Could you also as a test try a page with ObjectDataSource and see if that fails with the same error?

(EDIT) Mohamed, is your site (http://www.nilecon.com/) working now or what? I don't see the exception anymore.

mohamed avatar
mohamed
User
Posts: 136
Joined: 10-Mar-2008
# Posted on: 25-Nov-2008 11:45:15   

Mohamed, is your site (http://www.nilecon.com/) working now or what? I don't see the exception anymore

As I have deadline I try to replace LLBLDatasource with MS SQLdatasource and it's worked “nothing change else”

but I not satisfy with MS SQLdatasource and want to return to LLBLdatasource

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39859
Joined: 17-Aug-2003
# Posted on: 25-Nov-2008 11:58:27   

If you're using adapter, try to switch on fast serialization (as it happens during viewstate data serialization).

I have no idea why this happens, as the reflection we use (which isn't very often) is only on public members which is always allowed. Also the stacktrace suggests that the reflection is done by ASP.NET itself on a type placed in the viewstate and it needs reflection to produce proper data. This could be caused by entity data stored inside the viewstate (field instances aren't implementing ISerializable, they have [Serializable] attributes), hence my suggestion to use fastserialization which bypasses the binary formatter.

Frans Bouma | Lead developer LLBLGen Pro
mohamed avatar
mohamed
User
Posts: 136
Joined: 10-Mar-2008
# Posted on: 03-Dec-2008 12:23:01   

I used fastserialization but still throw same exception anyhow i changed my host to DISCOUNTASP and it worked without doing any thing Thanks All...