<< Previous Post
Next Post >>



Posted by admin under General  sBlog.Net  on Feb 24 2013

The current build of sBlog.Net is optimized for shared hosting. This is because of the following reason: UserIdnetity is one of the classes that is part of the core web framework. It has to be serializable, so as to support the object being able to be stored in the context for a user. In order to make the object safe to be serialized, UserIdentity class implements the ISerializable interface, and implements the GetObjectData method. Also, if you notice, this method is marked with the SecurityCritical attribute.

In order to support this method in a shared hosting environment, the following line is added to AssemblyInfo.cs file in the sBlog.Net project.

[assembly: SecurityRules(SecurityRuleSet.Level1)]


Without this line, you will get the following exception:
Inheritance security rules violated while overriding member: 'sBlog.Net.Models.UserIdentity.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.TypeLoadException: Inheritance security rules violated while overriding member: 'sBlog.Net.Models.UserIdentity.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.
Thus, in order to avoid the exception above, the code snippet above is added to the AssemblyInfo.cs. In a non-shared environment or when you are running locally, this won't be needed. Leaving this in-tact won't affect either.

Bin-Deployed MVC 3:
Some shared hosting providers do not install MVC 3 in their GAC by default, this is due to the fact that multiple versions of MVC in the GAC can create conflicts. In that case, you will have to bin-deploy the required assemblies to run MVC 3. Refer to the following posts:

In the case of my provider, I will have to bin-deploy the following files:

If you prefer downloading them instead of finding them in your local machine, click here!

Tagged sblog.net 
share the love!



comments

there are no comments for this post. be the first to post one!


post your comment

name (*) - required
email address (*) - required
site address
your comment (*) - required

(*) - required


<< Previous Post
Next Post >>