Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET POP3

 AfterLogic Forum : MailBee.NET POP3
Subject Topic: Could not load type ’System.Byte’ ... Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
tetranz
Newbie
Newbie


Joined: 25 February 2007
Online Status: Offline
Posts: 1
Posted: 25 February 2007 at 4:54pm | IP Logged Quote tetranz

Hi

I'm playing with the free trial of MailBee.NET POP3. I have it working nicely on my own machine but when I try it on my web host I get an exception. I'll paste it below.

My host runs medium trust but before I started I tested SocketPermission with a little test program and that seems to be enabled. This error seems to be related to the line of code when I set the license key. Some web searching suggests that this might be related to obfuscation.

I got this error with the C# pop3 sample app and then with my own app. I'm running VS2005 SP1.

Any ideas?

Regards
Ross

Could not load type 'System.Byte' from assembly 'MailBee.NET, Version=2.0.0.6, Culture=neutral, PublicKeyToken=cd85b70fb26f9fc1' due to value type mismatch.
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: Could not load type 'System.Byte' from assembly 'MailBee.NET, Version=2.0.0.6, Culture=neutral, PublicKeyToken=cd85b70fb26f9fc1' due to value type mismatch.

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:

[TypeLoadException: Could not load type 'System.Byte' from assembly 'MailBee.NET, Version=2.0.0.6, Culture=neutral, PublicKeyToken=cd85b70fb26f9fc1' due to value type mismatch.]
   bk.a(String A_0, Type A_1, a3& A_2) +0
   bk.a(String A_0, Type A_1) +174
   MailBee.Pop3Mail.Pop3.set_LicenseKey(Strin g value) +22
   MailBeeTest.mbtest.Button1_Click(Object sender, EventArgs e) +15
   System.EventHandler.Invoke(Object sender, EventArgs e) +0
   System.Web.UI.WebControls.Button.OnClick(E ventArgs e) +105
   System.Web.UI.WebControls.Button.RaisePost BackEvent(String eventArgument) +107
   System.Web.UI.WebControls.Button.System.We b.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
   System.Web.UI.Page.RaisePostBackEvent(IPos tBackEventHandler sourceControl, String eventArgument) +11
   System.Web.UI.Page.RaisePostBackEvent(Name ValueCollection postData) +33
   System.Web.UI.Page.ProcessRequestMain(Bool ean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102


Back to Top View tetranz's Profile Search for other posts by tetranz
 
Andrew
AfterLogic Support
AfterLogic Support


Joined: 28 April 2006
Location: United States
Online Status: Offline
Posts: 1189
Posted: 26 February 2007 at 3:23am | IP Logged Quote Andrew

This error indicates .NET Framework 2.0 installation is damaged. For instance, this occurs when SQL Server 2005 SP1 update gets installed. The solution is to uninstall SQL Server 2005 SP1 or select Repair option in .NET Framework 2.0 installer.

Useful link:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=686539 &SiteID=1

Best regards,
Andrew
Back to Top View Andrew's Profile Search for other posts by Andrew
 
Mhd
Newbie
Newbie


Joined: 18 February 2008
Location: United Kingdom
Online Status: Offline
Posts: 38
Posted: 30 August 2008 at 2:35am | IP Logged Quote Mhd

Andrew wrote:
This error indicates .NET Framework 2.0 installation is damaged.


I do not think that is true! We got this message on our website that we host on godaddy.com, I do not think that a well known hoster like godaddy.com allow .NET Framework to be damaged.
Back to Top View Mhd's Profile Search for other posts by Mhd
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6043
Posted: 01 September 2008 at 6:27am | IP Logged Quote Igor

The exception message clearly states that MailBee.NET.dll assembly attempts to use Byte class defined in System namespace (mscorlib.dll file). As the assembly is unable to access the core namespace of .NET Framework, it means that the issue is caused by problems in .NET Framework installation.

Have you tried to contact GoDaddy support staff regarding this issue?

Regards,
Igor
Back to Top View Igor's Profile Search for other posts by Igor
 
Mhd
Newbie
Newbie


Joined: 18 February 2008
Location: United Kingdom
Online Status: Offline
Posts: 38
Posted: 02 September 2008 at 7:07am | IP Logged Quote Mhd

I just contacted them and they told me this problem is related with the meduim trust level and that is true because I changed the trust level to full and this error disappeared but when I returned the trust level to meduim this error re-occur. Now the question is how can I make this component to work on meduim trust level without this error? Do you have a fix?
By the way I have the latest version.
Back to Top View Mhd's Profile Search for other posts by Mhd
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6043
Posted: 02 September 2008 at 7:32am | IP Logged Quote Igor

Please let us know the exact build number of the MailBee.NET.dll you are using. You can see it in .dll Properties or using MailMessage.Version property.

Regards,
Igor
Back to Top View Igor's Profile Search for other posts by Igor
 
Mhd
Newbie
Newbie


Joined: 18 February 2008
Location: United Kingdom
Online Status: Offline
Posts: 38
Posted: 02 September 2008 at 7:40am | IP Logged Quote Mhd

We are using version 3.0.1.74
Back to Top View Mhd's Profile Search for other posts by Mhd
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 02 September 2008 at 7:47am | IP Logged Quote Alex

You should use .NET 2.0+ optimized version 3.0.2.x. 3.0.1.x versions are for .NET 1.1. Although .NET Framework should be backward compatible, it's not always so.

By the way, build 74 is very old.

You can get the latest version (.NET 2.0+ optimized) from http://www.afterlogic.com/updates/mailbee_net_2.zip

The current one is 4.0.2.110.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
Mhd
Newbie
Newbie


Joined: 18 February 2008
Location: United Kingdom
Online Status: Offline
Posts: 38
Posted: 02 September 2008 at 8:17am | IP Logged Quote Mhd

The problem still exist even after installing the new version but with a different error message, when I change the trust level to full it disappears, here is the new error message:

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 for the permission of type 'System.Net.SocketPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Source Error:


Line 115:
Line 116:         &n bsp;  'If ACCOUNT_NAME = "" Or ACCOUNT_PASSWORD = "" Then Continue For
Line 117:         &n bsp;  imp.Connect(SERVER_NAME)
Line 118:
Line 119:         &n bsp;  imp.Login(USERNAME, ACCOUNT_PASSWORD, AuthenticationMethods.Regular)


Source File: E:\Projects\SmartKnowledgebase2.5\SmartKnowledgebase\Admin\A utoTickets\ProccessMessages.aspx.vb    L ine: 117

Stack Trace:


[SecurityException: Request for the permission of type 'System.Net.SocketPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
   System.Security.CodeAccessSecurityEngine.C heck(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
   System.Security.CodeAccessPermission.Deman d() +59
   System.Net.Sockets.Socket.CheckCacheRemote (EndPoint& remoteEP, Boolean isOverwrite) +176
   System.Net.Sockets.Socket.Connect(EndPoint remoteEP) +72
   bt.a(IPEndPoint A_0) +126
   co.a(IPEndPoint A_0) +16
   bg.a(IPHostEntry A_0, Int32 A_1) +105
   ay.a(String A_0, Int32 A_1, Boolean A_2, EndPoint A_3) +1019
   ay.y() +41
   bn.a5() +152
   ca.a(Boolean A_0, String A_1, Int32 A_2, Boolean A_3) +265
   ca.g(Boolean A_0, String A_1) +91
   MailBee.ImapMail.Imap.Connect(String serverName) +19
   SmartKnowledgebase.ProccessMessages.GetMes sage() in E:\...\ProccessMessages.aspx.vb:117
   SmartKnowledgebase.ProccessMessages.Page_L oad(Object sender, EventArgs e) in E:\Projects\SmartKnowledgebase2.5\SmartKnowledgebase\Admin\A utoTickets\ProccessMessages.aspx.vb:54
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +47
   System.Web.UI.Page.ProcessRequestMain(Bool ean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6978
   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +213
   System.Web.UI.Page.ProcessRequest() +86
   System.Web.UI.Page.ProcessRequestWithNoAss ert(HttpContext context) +18
   System.Web.UI.Page.ProcessRequest(HttpCont ext context) +49
   ASP.admin_autotickets_proccessmessages_asp x.ProcessRequest(HttpContext context) +29
   System.Web.CallHandlerExecutionStep.System .Web.HttpApplication.IExecutionStep.Execute() +303
   System.Web.HttpApplication.ExecuteStep(IEx ecutionStep step, Boolean& completedSynchronously) +64


Back to Top View Mhd's Profile Search for other posts by Mhd
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 02 September 2008 at 8:44am | IP Logged Quote Alex

That's correct. SocketPermissions means your environment does not allow making network connections on medium trust level. Obvisously, you should increase trust level in order to be able to make network connections.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
Mhd
Newbie
Newbie


Joined: 18 February 2008
Location: United Kingdom
Online Status: Offline
Posts: 38
Posted: 02 September 2008 at 9:03am | IP Logged Quote Mhd

We have a production software which will be installed on hosting servers which means that it will be used on on Meduim trust level environment!
Back to Top View Mhd's Profile Search for other posts by Mhd
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 02 September 2008 at 9:25am | IP Logged Quote Alex

SocketException means the current environment does not allow the application to make network connections. Obviously, the software which needs to make network connections, cannot be used where making network connections is not allowed.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 02 September 2008 at 9:30am | IP Logged Quote Alex

However, many shared hosting providers allow making connections. The security policy of each provider is different and there is no common approach.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
Mhd
Newbie
Newbie


Joined: 18 February 2008
Location: United Kingdom
Online Status: Offline
Posts: 38
Posted: 02 September 2008 at 9:34am | IP Logged Quote Mhd

Is this a general case for all meduim trust level or just for our environment?
From microsoft website the meduim trust level limitations are:
1- Calling unmanaged code.
2 -Accessing the registry.
3- Writing to the event log.
4- Connecting to databases other than SQL Server.
5- Accessing Web resources on remote servers.
6- Accessing the file system beyond your application's virtual directory hierarchy.

I think using sockets are allowed in meduim level!
Back to Top View Mhd's Profile Search for other posts by Mhd
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 02 September 2008 at 9:57am | IP Logged Quote Alex

It's your environment limitation. Trust levels defined by .NET are just defaults and can (and often are) overridden.

In our environment, socket connections work on medium trust.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 03 September 2008 at 3:37am | IP Logged Quote Alex

Update. After resetting trust levels to dfeaults we found that sockets are indeed disabled at Medium Trust level.

The reason they are usually enabled at shared hostings is that the most popular setting there is High, not Medium, and some hosting providers set Medium but additionally enable sockets.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide