Hosting ASP websites and WCF services on GoDaddy

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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’ 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 for the permission of type ‘System.Security.Permissions.ReflectionPermission, mscorlib, Version=4.0.0.0, 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.Security.CodeAccessPermission.Demand() +46
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.

<configuration>
<system.web>
<trust level=”Full” />
</system.web>
</configuration>

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.

2 thoughts on “Hosting ASP websites and WCF services on GoDaddy

  1. Prasanna

    May I know how to host WCF services on GoDaddy?Ur help would be really grateful.

    Reply
  2. 83Justin

    Hello admin, i must say you have very interesting posts here.
    Your page can go viral. You need initial traffic boost only.

    How to get it? Search for: Mertiso’s tips go viral

    Reply

Leave a Reply

Your email address will not be published.