Medium Trust Issue on Local (XP SP2, IIS 5.1)

Post here for help with installing or upgrading mojoPortal pre-compiled release packages. When posting in this forum, please provide all relevant details. You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

Post here for help with installation of mojoPortal pre-compiled release packages

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.

You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

This thread is closed to new posts. You must sign in to post in the forums.
8/5/2008 5:46:36 PM
Gravatar
Total Posts 4

Medium Trust Issue on Local (XP SP2, IIS 5.1)

Hi Mojo community!
Especial thanks to mojo active community and clean documentations!
I am not able to test mojo on my local machine before going to deploy it on my medium trust configured host, can’t getting rid of SecurityException!

Here is the configurations and info:

  •  I’ve got mojoportal-2-2-6-6-b-sourcecode.zip
  •  OS:XP SP2, IIS 5.1, MSSQL2000 (I do not think MSSQL2000 or MSSQL2005 is the issue, I know the Joe does not have MSSQL200 around ;) )
  •  Changed the trust level in machine’s web.config to medium. (the medium trust policy file is unchanged and the default one, I am using .NET2.)
  •  VS2008 installed and so .NET2, and .NET 3.5 installed.
  •  I have considered and applied all the instructions mentioned in http://www.mojoportal.com/mediumtrust.aspx and even seen some forum entries(I have checked it multiple times ).
  •  The mojo installation is complete and flawless.

But when I am going to visit the home page, there will be the familiar security exception by the following exact stack trace:
[SecurityException: Request for the permission of type 'System.Configuration.ConfigurationPermission, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed.]
System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
System.Security.CodeAccessPermission.Demand() +59
System.Configuration.BaseConfigurationRecord.CheckPermissionAllowed(String configKey, Boolean requirePermission, Boolean isTrustedWithoutAptca) +65

I’ve even considered the last release “mojoportal-2-2-6-7-mssqlreleasefiles.zip”, but the issue persists!Is the default medium trust policy file more restricted that the ones configured by common medium trust hosts?
Any help or suggestions would be appreciated!


Regards
Gafnoo

8/6/2008 7:05:42 AM
Gravatar
Total Posts 18439

Re: Medium Trust Issue on Local (XP SP2, IIS 5.1)

Hi,

I'm able to get it working on XP SP3 with IIS 5.1, and SQL 2005.

I create the Medium Trust environment by adding this to system.web section of Web.config

<trust level="Medium" originUrl="" />

It works fine for me. Every time I rebuild I have to delete the DotNetOpenId.dll again but other than that inconvenience it works fine.

I'm testing using the latest svn, so maybe you should try getting the code from svn trunk.

If you have developed any custom modules of your own, its possible one of those is causing this issue for you.

Hope it helps,

Joe

8/7/2008 4:36:54 PM
Gravatar
Total Posts 4

Re: Medium Trust Issue on Local (XP SP2, IIS 5.1)

Hi Joe!
Thanks for your response!
I have downloaded the latest codes from svn and even changed my DBMS to MSSQL Server 2005 Express Edition, but the same issue persists again! It’s too bad! I do not know what to do with this! And the worst thing is that, I don’t know how to trace and find the code causing such a situation!
So great man! What to do next time??! I am so eager to use this mojo! Please help me!
(If you are suspected on my web.config file, it may be rude but I gonna ask you send me your web.config file)
Best Regards
Gafnoo
 

8/7/2008 5:21:12 PM
Gravatar
Total Posts 18439

Re: Medium Trust Issue on Local (XP SP2, IIS 5.1)

Hi,

If you open the file Web.mediumtrust.config and copy the contents and paste it into Web.config then you have the same file I tested.

Have you tried setting your machine.config back to Full Trust and test that way first?

One possibility that I have seen before is, if your machine is a member of a domain, it may be ignoring your machine.config and using settings passed down to your machine by group policy. So its possible you are locked down to something even more restrictive like Low Trust in which case it just can't work unless you can get your domain admin to create an exception for you.

Hope it helps,

Joe

8/7/2008 6:26:54 PM
Gravatar
Total Posts 4

Re: Medium Trust Issue on Local (XP SP2, IIS 5.1)

Hi Joe!
In full trust every things is fine for me, so I don’t think it is related to domain related security or something like that! Also my local mojo is fully sensitive to what I’ve been set in my machine config. Even I have tested the medium trust level in your manner, placing it in application level!
What a bad situation!
Still thanks again for your consideration
Sincerely yours
Gafnoo
 

10/10/2008 1:23:01 PM
Gravatar
Total Posts 18439

Re: Medium Trust Issue on Local (XP SP2, IIS 5.1)

I finally encountered this issue myself on a machine and after a lot of investigation I finally found the cause and solution.

The solution is you must install ASP.NET 2.0 AJAX 1.0 in the GAC (Global Assembly Cache), by using the msi installer for MS AJAX 1.0.

mojoPortal includes the System.Web.Extensions.dll file in the bin folder but in Medium Trust it can't run from the bin folder it has to be in the GAC on the server. If it is installed in the GAC it will ignore the one in the /bin folder so it doesn't hurt for it to be there but you can safely delete it.

So the reason I could not produce this problem on my machine in medium trust is because I already had this installed. When I encountered this on a different machine I finally was able to pin down the problem.

Hope it helps,

Joe

12/21/2008 4:21:30 PM
Gravatar
Total Posts 4

Re: Medium Trust Issue on Local (XP SP2, IIS 5.1)

Hi Joe!

I've got exited seeing your response, getting back after long time! thanks man!

But again I've got another exception on site setup by the same configuration as before:

----------------------------------------------------------------------------------------------------------------------

Welcome to site Setup
Probing system...
File system permissions ok.
The system cannot connect to the MySQL database. Please check your connection string.

MySql.Data.MySqlClient.MySqlException: Unable to connect to any of the specified MySQL hosts. ---> System.Security.SecurityException: Request for the permission of type 'System.Net.SocketPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) at System.Security.CodeAccessPermission.Demand() at System.Net.Sockets.Socket.CheckCacheRemote(EndPoint& remoteEP, Boolean isOverwrite) at System.Net.Sockets.Socket.BeginConnectEx(EndPoint remoteEP, Boolean flowContext, AsyncCallback callback, Object state) at System.Net.Sockets.Socket.BeginConnect(EndPoint remoteEP, AsyncCallback callback, Object state) at MySql.Data.Common.StreamCreator.CreateSocketStream(IPAddress ip, Boolean unix) at MySql.Data.Common.StreamCreator.GetStream(UInt32 timeout) at MySql.Data.MySqlClient.NativeDriver.Open() The action that failed was: Demand The type of the first permission that failed was: System.Net.SocketPermission The Zone of the assembly that failed was: MyComputer --- End of inner exception stack trace --- at MySql.Data.MySqlClient.NativeDriver.Open() at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings) at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection() at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection() at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver() at MySql.Data.MySqlClient.MySqlPool.GetConnection() at MySql.Data.MySqlClient.MySqlConnection.Open() at mojoPortal.Data.DBPortal.DatabaseHelperGetConnectionError(String overrideConnectionInfo) in C:\development\mojo2-2-6-6\mojoPortal.Data.MySql\dbPortal.cs:line 532

Note: This page shows some information that is helpful during setup and upgrades but for security it would be best not to show any information when the system is up to date. You can disable setup and suppress all information on this page by setting DisableSetup=true in Web.config. When you need to upgrade, you can set this back to false. If you are logged in as Administrator setup will run and you will be able to see this page even if it is disabled in Web.config so you can easily leave it disabled and just login before upgrading. But if you are not logged in you will need to enable setup in Web.config.

-------------------------------------------------------------------------------------------------------------------------------------

Regards

Gafnoo

12/23/2008 8:06:36 AM
Gravatar
Total Posts 18439

Re: Medium Trust Issue on Local (XP SP2, IIS 5.1)

This is not the same as your previous issue, you were using MS SQL and now you are using MySql.

As indicated in our Medium Trust documentation, to use MySql in Medium Trust, the MySql Connector for .NET must be installed in the GAC (Global Assembly Cache).

Hope it helps,

Joe

You must sign in to post in the forums. This thread is closed to new posts.