Medium Trust issues in hosting environment with Mojo.

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.
3/28/2009 11:28:13 PM
Gravatar
Total Posts 20

Medium Trust issues in hosting environment with Mojo.

OP - Windows; DB - MySQL 4.0; 2.2.9.6 - Configured for medium trust per mojo documentation.

I recently setup mojo portal (started with 2.2.9.2) in Feb 2009.  When I started I had all sorts of connection errors and trust level errors.  I am operating in a medium trust level environment, but my host asked me to add the following code to my web.config file.  From my understanding, it is a workaround that basically makes it a full trust environment.  I used the script and made a few changes to my connection string and my errors cleared up and I got a clean install.  Trouble is I never removed the code below and when I went to upgrade to 2.2.9.6 without this code, I get the same connection errors.  I even put it back in ran the setup (setup ran fine) and then took it out.  When I went to the website it loaded the url, but got a blank screen.  Any ideas for fixing my medium trust environment so I can work with out this full trust workaround?   As a little background I am adding a link to the original post below the code block....Thank you.

<location allowOverride="true">
<system.web>
<securityPolicy>
<trustLevel name="Full" policyFile="internal"/>
<trustLevel name="High" policyFile="web_hightrust.config"/>
<trustLevel name="Medium" policyFile="web_mediumtrust.config"/>
<trustLevel name="Low" policyFile="web_lowtrust.config"/>
<trustLevel name="Minimal" policyFile="web_minimaltrust.config"/>
</securityPolicy>
<trust level="Full" originUrl=""/>
</system.web>
</location>

 

http://www.mojoportal.com/Forums/Thread.aspx?thread=2577&mid=34&pageid=5&ItemID=3

3/29/2009 6:42:58 AM
Gravatar
Total Posts 18439

Re: Medium Trust issues in hosting environment with Mojo.

Hi Brian,

None of this makes any sense to me. When a host enforces medium trust they enforce it from the machine.config file on the server so it can't be overridden in Web.config.

In a full trust environment you can simulate medium trust by adding this in Web.config: 
<trust level="Medium" originUrl=".*" />

Thats how I test mojoPortal in medium trust.

So you can go more restrictive in Web.config than what is specified in machine.config but you can't go less restrictive, machine.config settings trump web.config

That stuff they are telling you to put in Web.config looks like it should be in machine.config not web.config. If they let you "work around" to make it full trust then they are not really enforcing medium trust so its just pointless misconfiguration they are doing. Seems very strange.

Best,

Joe

3/29/2009 8:19:32 AM
Gravatar
Total Posts 20

Re: Medium Trust issues in hosting environment with Mojo.

Joe,

Thank you for the reponses.  Can you give me some steps or suggestions to look at why I might be getting the errors I am getting with out that code set above? I will go back to my host and validate how they are "enforcing" medium trust.

Obviously, I'd like to get this working without this "workaround" and want to make sure there is not a security hole at the same time.

Brian

3/29/2009 8:31:55 AM
Gravatar
Total Posts 18439

Re: Medium Trust issues in hosting environment with Mojo.

In order to help I have to know what errors you are getting. 

3/29/2009 10:43:27 AM
Gravatar
Total Posts 20

Re: Medium Trust issues in hosting environment with Mojo.

Joe,

With this code (see end of file) at the end of web.config, my site loads and runs properly.  Without it, when I reload the page it sends me to a blank page with no errors

http://domainname.com/home.aspx 

When I add the code back in and reload the home.aspx page it loads my domain.com/default.aspx into the home.aspx file. Forgive me as I am not sure why the home.aspx file is being loaded.  Maybe you have some insight.

I have done the medium trust items in my code per your tutorial instructions.

1. Rename Web.config file to Web.fulltrust.config - Check
2. Rename Web.mediumtrust.config to Web.config - Check
3. Delete DotNetOpenId.dll from the /bin folder - Check
4. Make sure and visit your /Setup/Default.aspx page, it should tell you a setting you need to add to Web.config for the search engine to get around a medium trust issue. Added the following code to Web.config in the AppSettings section: <add key="Lucene.Net.lockdir" value="e:\domains\bar-ms.com\wwwroot\Data\Sites\1\index" /> - Check

5. Set the following in web.config - <add key="RunningInMediumTrust" value="true" /> - Check

Ultimately, it works with the code below in web.config...but I want to make it work without it and to make sure I am not opening up a security issue.  If there are specific questions and suggested settings I need to ask my host about please let me know... all help appreciated.

<location allowOverride="true">
<system.web>
<securityPolicy>
<trustLevel name="Full" policyFile="internal"/>
<trustLevel name="High" policyFile="web_hightrust.config"/>
<trustLevel name="Medium" policyFile="web_mediumtrust.config"/>
<trustLevel name="Low" policyFile="web_lowtrust.config"/>
<trustLevel name="Minimal" policyFile="web_minimaltrust.config"/>
</securityPolicy>
<trust level="Full" originUrl=""/>
</system.web>
</location>

3/29/2009 11:00:23 AM
Gravatar
Total Posts 18439

Re: Medium Trust issues in hosting environment with Mojo.

I would look and see if anything is logged in the mojoPortal log whe you see the blank page. First clear the log to get rid of old errors - Administration Menu > System Log 

Removing that from your Web.config is not going to make you any more secure.

The security benefit to enforcing medium trust is mainly because you are in shared hosting and it can prevent other .NET apps from other users from doing bad things that could impact your site. Medium trust limits what the code can do so really its limiting your own app, like you don't get the benefits of using NeatUpload. It limits code from doing things that could be used maliciously but it also limits non-malicious thigns that could be done but require more trust. So the idea of enforcing medium trust is to protect your site since it is on the same server as other sites, if they were really enforcing medium trust then other sites on the server have less possibility to hurt your site, but if they have this workaround where you can change it in Web.config that means they really are not enforcing it, others can do the same thing and elevate their site to full trust and maybe write code that could attack other sites on the same server.

So removing this from your web.config is only giving you the disadvantages of medium trust without any benefits because they are not really enforcing it if anyone can work around it in Web.config. That means the bad guys could configure their sites with malicious code to run in fuill trust while your site which has no malicious code is running in medium trust.

If you were on a dedicated server with no sites but your own there would be nearly 0 benefit to running in medium trust and in fact it would be preferrable to run in full trust so the nice features like NeatUpload can be used, its really designed to make shared hosting more safe by protecting you from other code running on the server that is not yours, the tradeoff is it also limits your own code. I don't get a good feeling about your host, it seems they really do not understand what they are doing and have some weird misconfigured trust policy.

Hope it helps,

Joe

3/29/2009 11:04:49 AM
Gravatar
Total Posts 18439

Re: Medium Trust issues in hosting environment with Mojo.

However, I would not be extremely paranoid about it either, because some hosts do offer full trust shared hosting. I used DiscountASP full trust hosting for a long time with no problems. A correctly configured server is protected somewhat by file system permissions and other things that generally isolate web applications from one another. Medium Trust when used correctly is just one more layer of protection and every bit can help. It doesn't make you a sitting duck to run in Full Trust.

Best,

Joe

3/29/2009 1:11:47 PM
Gravatar
Total Posts 20

Re: Medium Trust issues in hosting environment with Mojo.

Joe - Thanks for the notes back today.  I appreciate the assistance. B

 

I cleared the log and ran it without the code in question...got the same blank screen.

Then I reinstituted the code and refreshed the site and it "worked" fine.  Went back to the system log file and this very long set of messages is what I got:

2009-03-29 18:00:03,625 INFO mojoPortal.Web.Global - Global.asax.cs Application_End
2009-03-29 18:00:33,859 INFO mojoPortal.Web.Global - Application Started.
2009-03-29 18:00:33,875 ERROR mojoPortal.Web.Global - Application_Start Could not register VirtualPathProvider, must be running in Medium trust or lower
System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
at mojoPortal.Web.Global.RegisterVirtualPathProvider()
at mojoPortal.Web.Global.Application_Start(Object sender, EventArgs e)
The action that failed was:
InheritanceDemand
The type of the first permission that failed was:
System.Web.AspNetHostingPermission
The Zone of the assembly that failed was:
MyComputer
2009-03-29 18:00:34,046 ERROR mojoPortal.Web.WebTaskManager - 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 MySql.Data.MySqlClient.MySqlHelper.ExecuteReader(String connectionString, String commandText, MySqlParameter[] commandParameters)
at mojoPortal.Data.DBTaskQueue.GetUnfinished()
at mojoPortal.Business.TaskQueue.GetUnfinished()
at mojoPortal.Web.WebTaskManager.StartOrResumeTasks(Boolean appWasRestarted)
2009-03-29 18:00:34,109 ERROR mojoPortal.Web.BannedIPBlockingHttpModule - handled exception:
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 MySql.Data.MySqlClient.MySqlHelper.ExecuteScalar(String connectionString, String commandText, MySqlParameter[] commandParameters)
at mojoPortal.Data.DBBannedIP.IsBanned(String ipAddress)
at mojoPortal.Business.BannedIPAddress.IsBanned(String ipAddress)
at mojoPortal.Web.BannedIPBlockingHttpModule.BeginRequest(Object sender, EventArgs e)
2009-03-29 18:00:34,171 ERROR mojoPortal.Business.WebHelpers.CacheHelper - Error trying to obtain siteSettings
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 MySql.Data.MySqlClient.MySqlHelper.ExecuteReader(String connectionString, String commandText, MySqlParameter[] commandParameters)
at mojoPortal.Data.DBSiteSettings.GetSite(String hostName)
at mojoPortal.Business.SiteSettings.GetSiteSettings(String hostName)
at mojoPortal.Business.SiteSettings..ctor(String hostName)
at mojoPortal.Business.WebHelpers.CacheHelper.LoadSiteSettings()
2009-03-29 18:00:52,125 ERROR mojoPortal.Business.WebHelpers.CacheHelper - Error trying to obtain siteSettings
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 MySql.Data.MySqlClient.MySqlHelper.ExecuteReader(String connectionString, String commandText, MySqlParameter[] commandParameters)
at mojoPortal.Data.DBSiteSettings.GetSite(String hostName)
at mojoPortal.Business.SiteSettings.GetSiteSettings(String hostName)
at mojoPortal.Business.SiteSettings..ctor(String hostName)
at mojoPortal.Business.WebHelpers.CacheHelper.LoadSiteSettings()
2009-03-29 18:00:52,265 ERROR mojoPortal.Business.WebHelpers.CacheHelper - Error trying to obtain siteSettings
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 MySql.Data.MySqlClient.MySqlHelper.ExecuteReader(String connectionString, String commandText, MySqlParameter[] commandParameters)
at mojoPortal.Data.DBSiteSettings.GetSite(String hostName)
at mojoPortal.Business.SiteSettings.GetSiteSettings(String hostName)
at mojoPortal.Business.SiteSettings..ctor(String hostName)
at mojoPortal.Business.WebHelpers.CacheHelper.LoadSiteSettings()
2009-03-29 18:00:52,265 ERROR mojoPortal.Business.WebHelpers.CacheHelper - Error trying to obtain siteSettings
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 MySql.Data.MySqlClient.MySqlHelper.ExecuteReader(String connectionString, String commandText, MySqlParameter[] commandParameters)
at mojoPortal.Data.DBSiteSettings.GetSite(String hostName)
at mojoPortal.Business.SiteSettings.GetSiteSettings(String hostName)
at mojoPortal.Business.SiteSettings..ctor(String hostName)
at mojoPortal.Business.WebHelpers.CacheHelper.LoadSiteSettings()
2009-03-29 18:00:52,296 ERROR mojoPortal.Business.WebHelpers.CacheHelper - Error trying to obtain siteSettings
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 MySql.Data.MySqlClient.MySqlHelper.ExecuteReader(String connectionString, String commandText, MySqlParameter[] commandParameters)
at mojoPortal.Data.DBSiteSettings.GetSite(String hostName)
at mojoPortal.Business.SiteSettings.GetSiteSettings(String hostName)
at mojoPortal.Business.SiteSettings..ctor(String hostName)
at mojoPortal.Business.WebHelpers.CacheHelper.LoadSiteSettings()
2009-03-29 18:00:52,296 ERROR mojoPortal.Business.WebHelpers.CacheHelper - Error trying to obtain siteSettings
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 MySql.Data.MySqlClient.MySqlHelper.ExecuteReader(String connectionString, String commandText, MySqlParameter[] commandParameters)
at mojoPortal.Data.DBSiteSettings.GetSite(String hostName)
at mojoPortal.Business.SiteSettings.GetSiteSettings(String hostName)
at mojoPortal.Business.SiteSettings..ctor(String hostName)
at mojoPortal.Business.WebHelpers.CacheHelper.LoadSiteSettings()
2009-03-29 18:00:52,296 ERROR mojoPortal.Business.WebHelpers.CacheHelper - Error trying to obtain siteSettings
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 MySql.Data.MySqlClient.MySqlHelper.ExecuteReader(String connectionString, String commandText, MySqlParameter[] commandParameters)
at mojoPortal.Data.DBSiteSettings.GetSite(String hostName)
at mojoPortal.Business.SiteSettings.GetSiteSettings(String hostName)
at mojoPortal.Business.SiteSettings..ctor(String hostName)
at mojoPortal.Business.WebHelpers.CacheHelper.LoadSiteSettings()
2009-03-29 18:00:52,312 ERROR mojoPortal.Business.WebHelpers.CacheHelper - Error trying to obtain siteSettings
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 MySql.Data.MySqlClient.MySqlHelper.ExecuteReader(String connectionString, String commandText, MySqlParameter[] commandParameters)
at mojoPortal.Data.DBSiteSettings.GetSite(String hostName)
at mojoPortal.Business.SiteSettings.GetSiteSettings(String hostName)
at mojoPortal.Business.SiteSettings..ctor(String hostName)
at mojoPortal.Business.WebHelpers.CacheHelper.LoadSiteSettings()
2009-03-29 18:00:52,328 ERROR mojoPortal.Business.WebHelpers.CacheHelper - Error trying to obtain siteSettings
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 MySql.Data.MySqlClient.MySqlHelper.ExecuteReader(String connectionString, String commandText, MySqlParameter[] commandParameters)
at mojoPortal.Data.DBSiteSettings.GetSite(String hostName)
at mojoPortal.Business.SiteSettings.GetSiteSettings(String hostName)
at mojoPortal.Business.SiteSettings..ctor(String hostName)
at mojoPortal.Business.WebHelpers.CacheHelper.LoadSiteSettings()
2009-03-29 18:00:52,375 ERROR mojoPortal.Web.BannedIPBlockingHttpModule - handled exception:
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 MySql.Data.MySqlClient.MySqlHelper.ExecuteScalar(String connectionString, String commandText, MySqlParameter[] commandParameters)
at mojoPortal.Data.DBBannedIP.IsBanned(String ipAddress)
at mojoPortal.Business.BannedIPAddress.IsBanned(String ipAddress)
at mojoPortal.Web.BannedIPBlockingHttpModule.BeginRequest(Object sender, EventArgs e)
2009-03-29 18:00:52,375 ERROR mojoPortal.Business.WebHelpers.CacheHelper - Error trying to obtain siteSettings
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 MySql.Data.MySqlClient.MySqlHelper.ExecuteReader(String connectionString, String commandText, MySqlParameter[] commandParameters)
at mojoPortal.Data.DBSiteSettings.GetSite(String hostName)
at mojoPortal.Business.SiteSettings.GetSiteSettings(String hostName)
at mojoPortal.Business.SiteSettings..ctor(String hostName)
at mojoPortal.Business.WebHelpers.CacheHelper.LoadSiteSettings()
2009-03-29 18:00:52,375 ERROR mojoPortal.Web.UrlRewriter - System.NullReferenceException: Object reference not set to an instance of an object.
at mojoPortal.Web.UrlRewriter.GetRedirectUrl(String targetUrl)
at mojoPortal.Web.UrlRewriter.RewriteUrl(HttpApplication app)
2009-03-29 18:00:52,375 ERROR mojoPortal.Web.UrlRewriter - 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 MySql.Data.MySqlClient.MySqlHelper.ExecuteReader(String connectionString, String commandText, MySqlParameter[] commandParameters)
at mojoPortal.Data.DBFriendlyUrl.GetByUrl(String hostName, String friendlyUrl)
at mojoPortal.Business.FriendlyUrl.GetFriendlyUrl(String hostName, String friendlyUrl)
at mojoPortal.Business.FriendlyUrl..ctor(String hostName, String friendlyUrl)
at mojoPortal.Web.UrlRewriter.RewriteUrl(HttpApplication app)
at mojoPortal.Web.UrlRewriter.UrlRewriter_BeginRequest(Object sender, EventArgs e)
2009-03-29 18:00:52,390 ERROR mojoPortal.Business.WebHelpers.CacheHelper - Error trying to obtain siteSettings
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 MySql.Data.MySqlClient.MySqlHelper.ExecuteReader(String connectionString, String commandText, MySqlParameter[] commandParameters)
at mojoPortal.Data.DBSiteSettings.GetSite(String hostName)
at mojoPortal.Business.SiteSettings.GetSiteSettings(String hostName)
at mojoPortal.Business.SiteSettings..ctor(String hostName)
at mojoPortal.Business.WebHelpers.CacheHelper.LoadSiteSettings()
2009-03-29 18:00:54,406 ERROR mojoPortal.Business.WebHelpers.CacheHelper - Error trying to obtain siteSettings
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 MySql.Data.MySqlClient.MySqlHelper.ExecuteReader(String connectionString, String commandText, MySqlParameter[] commandParameters)
at mojoPortal.Data.DBSiteSettings.GetSite(String hostName)
at mojoPortal.Business.SiteSettings.GetSiteSettings(String hostName)
at mojoPortal.Business.SiteSettings..ctor(String hostName)
at mojoPortal.Business.WebHelpers.CacheHelper.LoadSiteSettings()
2009-03-29 18:02:25,187 INFO mojoPortal.Web.Global - Global.asax.cs Application_End
2009-03-29 18:03:14,859 INFO mojoPortal.Web.Global - Application Started.
 

3/29/2009 5:07:06 PM
Gravatar
Total Posts 18439

Re: Medium Trust issues in hosting environment with Mojo.

2009-03-29 18:00:52,125 ERROR mojoPortal.Business.WebHelpers.CacheHelper - Error trying to obtain siteSettings
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.

Ok so your hosts trust configuration is misconfigured so it cannot make a network connection to the MySql server. They either need to figure out how to properly configure their trust settings to allow network connections or you have to use their crazy workaround.

Hope it helps,

Joe

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