Recently I bought GoDaddy hosting for few purposes. Firstly, I want to integrate my web experiments into sunauskas.com domain and to keep this blog running on WordPress. Secondly, I am developing small project based on ASP.NET + WCF + DB (NHibernate ORM), so multiple users testing will be needed in near future.
I had almost no problems publishing ASP MVC website and WCF service. To make it clear, firstly I published files locally and after that just copied them to the host. Because GoDaddy at the moment doesn’t support publishing to the host directly (???). After that I came to some GoDaddy and .NET configuration issues.
Most issues occur because of the security configuration. This was that case. Locally my application is running on full trust. So I needed to be like that also on the hosting.
This is security exception which I was getting:
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 for the permission of type ‘System.Security.Permissions.ReflectionPermission, mscorlib, Version=220.127.116.11, Culture=neutral, PublicKeyToken=b77a5c561934e089’ failed.
|[SecurityException: Request for the permission of type ‘System.Security.Permissions.ReflectionPermission, mscorlib, Version=18.104.22.168, Culture=neutral, PublicKeyToken=b77a5c561934e089’ failed.]
System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission cap, StackCrawlMark& stackMark) +31
System.Reflection.Emit.DynamicMethod.PerformSecurityCheck(Module m, StackCrawlMark& stackMark, Boolean skipVisibility) +248
System.Reflection.Emit.DynamicMethod..ctor(String name, Type returnType, Type parameterTypes, Module m, Boolean skipVisibility) +49
System.Runtime.Serialization.CodeGenerator.BeginMethod(Type returnType, String methodName, Type argTypes, Boolean allowPrivateMemberAccess) +53
System.Runtime.Serialization.CodeGenerator.BeginMethod(String methodName, Type delegateType, Boolean allowPrivateMemberAccess) +131
System.Runtime.Serialization.CriticalHelper.GenerateClassReader(ClassDataContract classContract) +141
Here is my ASP.NET web site and WCF service hosting configuration with full trust.
<trust level=”Full” />
I hope this trick will save you few hours. It can be that your applications don’t require full trust and you can try to set any other trust level.