Medium trust issue?

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/4/2008 8:13:12 AM
Gravatar
Total Posts 40

Medium trust issue?

Hi all,

I'm having what I think are medium trust issues with both existing websites (which previously worked) and a new clean install of the latest version of MojoPortal.

When I perform a search I get the following error:

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: That assembly does not allow partially trusted callers.

Followed by (on the same error page):

Stack Trace:


[SecurityException: That assembly does not allow partially trusted callers.]
mojoPortal.Business.SerializationHelper.SerializeToSoap(Object obj) +0
mojoPortal.Business.WebHelpers.IndexWriterTask.QueueTask() +448
mojoPortal.Web.SiteUtils.QueueIndexing() +202
mojoPortal.Web.UI.Pages.SearchResults.DoSearch() +633
mojoPortal.Web.UI.Pages.SearchResults.Page_Load(Object sender, EventArgs e) +113
System.Web.UI.Control.OnLoad(EventArgs e) +99
mojoPortal.Web.mojoBasePage.OnLoad(EventArgs e) +9
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +7350
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +213
System.Web.UI.Page.ProcessRequest() +86
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.searchresults_aspx.ProcessRequest(HttpContext context) +4
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +358
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

I've used the MediumTrust web.config file and:
  - added my SQL connection
  - commented out <add namespace="Brettle.Web.NeatUpload" assembly="Brettle.Web.NeatUpload" tagPrefix="NeatUpload"/>
  - deleted Brettle.Web.NeatUpload.dll (last resort, I know this isn't necessary)
  - deleted DotNetOpenId.dll
I checked secure/log.aspx and the OpenId control doesn't exist on that page so nothing to delete, although a panel named pnlOpenID does exist.

Does anyone have any suggestions as to what the probem might be? I've read the MediumTrust instructions and looked through the web.config and dll files for anything obvious I may have missed but can't see anything.

No logs appear in Admin/System Log, and the log file on the server doesn't have anything in it.

Oddly this issue has also affected existing sites, and although I could have updated the web.config file on them at some point, it seems odd that it also affects a totally clean install. My web host runs in medium trust but I haven't had a problem with this before (I have existing sites which I've created and updated fine in the past) and he says no changes have been made whcih could have caused this to break.

Any help or information on this greatly appreciated guys.

Thanks in advance,
Matt

8/4/2008 8:39:15 AM
Gravatar
Total Posts 18439

Re: Medium trust issue?

In medium trust you need to specify the lock directory for Lucene.NET search index in Web.config or user.config like this:

<add key="Lucene.Net.lockdir" value="D:\__projects\mojoportal\joe\Web\Data\Sites\1\index" />

Note that you need to know the actual file system path to the index folder used by the site not the url.

The /Setup/Default.aspx page should indicate the correct path if it detects that you are running in medium trust and it provides a note for you to set this in Web.config

If that was missing or incorrect, then after correcting it I would back up the files from the index folder then delete them and do a search. This will rebuild the search index. Wait a few minutes for it to run because it queues a background thread that runs the task and it pauses several times during the process.

Hope it helps,

Joe

8/4/2008 8:42:49 AM
Gravatar
Total Posts 40

Re: Medium trust issue?

Hi Joe,

Thanks for the update. I dd have the search value set:

<add key="Lucene.Net.lockdir" value="xxxxxx\wwwroot\Data\Sites\1\index"/>

but I'll try deleting the files you mentioned and running a search again. Would this also fix the issue with updating HTML content for a page (which causes the same error)?

Thanks,
Matt

8/4/2008 8:44:26 AM
Gravatar
Total Posts 40

Re: Medium trust issue?

There are no files in /wwwroot/Data/Sites/1/index/

Thanks,
Matt

8/4/2008 8:48:52 AM
Gravatar
Total Posts 18439

Re: Medium trust issue?

Hi,

Nothing about deleting the files is fixing anything, it will just rebuild the index so anything that didn't get indexed before because of the errors will be indexed. If the error is still happening it won't rebuild the index, thats why I said to back up the files.

If that path for lucene is not correct it will still error when it tries to build the index. Since it indexes on a background thread you won't see any UI error but it will log errors in the log.

I would make sure you aren't missing any of the indexbuilderconfig files. They should be located at /Setup/ProviderConfig/indexbuilders

There are 8 files there, all 1K each in size. Make sure they exist. This location has moved since previous versions, it used to be under /Setup/indexbuilderconfig folder.

Hope it helps,

Joe

8/4/2008 8:50:31 AM
Gravatar
Total Posts 18439

Re: Medium trust issue?

I would double check that path too, in case the hosting company moved your site(s) from one server or drive to another.

8/4/2008 9:03:42 AM
Gravatar
Total Posts 40

Re: Medium trust issue?

Hi Joe,

I went through my hosting control panel to double check the index folder path and it's definitely correct. I've also checked the /Setup/indexbuilderconfig folder and all 8 files are there.

I'm going to try reinstalling to see if there was anything I missed during the install this morning (I don't think there was but I'll double check).

Oh and I just reran Setup/Default.aspx and got the following, looks like everything is in order although I don't see a message about the path...

Probing system...
File system permissions ok.
MSSQL database connection ok.
database permissions are sufficient to alter schema.
database initial schema already exists.
database core schema is up to date.
1 site(s) found.
Configuring feature Html Content - 00:00:01.2500000
Configuring feature Blog - 00:00:01.6406250
Configuring feature Contact Form - 00:00:02.0781250
Configuring feature Event Calendar - 00:00:02.1250000
Configuring feature Forums - 00:00:02.2656250
Configuring feature Google Map - 00:00:02.3125000
Configuring feature Image Gallery (Simple Folder Version) - 00:00:02.3750000
Configuring feature Image Gallery - 00:00:02.3906250
Configuring feature Links - 00:00:02.5156250
Configuring feature RSSFeed(s) - 00:00:02.5468750
Configuring feature Shared Files - 00:00:02.7343750
Configuring feature Site Statistics - 00:00:02.7500000
Configuring feature Html Fragment Include - 00:00:02.7968750
Configuring feature Xml/Xsl - 00:00:02.8125000
Configuring feature Web Part - 00:00:02.8437500
Configuring feature Poll - 00:00:02.9687500
Configuring feature Survey - 00:00:03.0312500
Configuring feature Web Store - 00:00:03.0625000
Ensuring all features are installed in server admin sites... - 00:00:03.0625000

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

Setup is complete, click the link below to go to the home page.
Site Home Page


Database PlatformMSSQL
Version2.2.6.6
StatusYour installation is up to date.

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.

Thanks,
Matt

8/4/2008 9:26:11 AM
Gravatar
Total Posts 18439

Re: Medium trust issue?

Hi Matt,

Our setup page has not the greatest way of detecting if its medium trust. I found a better method for detecting trust level that I will switch to so it shows the message more consistently.

I will investigate this a little further today by simulating medium trust on my machine and see if I can produce the same errors you are seeing.

Best,

Joe

8/4/2008 9:29:37 AM
Gravatar
Total Posts 40

Re: Medium trust issue?

Thanks a lot Joe. I can give you a hosting account if you like which you can use for this as well as testing new releases etc? So long as you don't push too much traffic through it! Drop me an email if you think it would be useful and I'll set it up for you and send you through the details.

Thanks,
Matt

8/4/2008 2:07:54 PM
Gravatar
Total Posts 18439

Re: Medium trust issue?

Hi Matt,

I was indeed able to produce the problem here and after much struggle I got it solved. When I implemented the cange in the search to use the taskqueue, I didn't realize that the SoapFormatter doesn't work in medium trust, and I was serializing the task into the db using SOAP.

I had to rework it all to use XmlSerializer which does work in medium trust.

I've uploaded a new file mojoportal-2-2-6-7-mssqlreleasefiles.zip which contains the fixed version. Iw ill upload files for other dbs by tomorrow but pretty much anyone using medium trust is using ms sql so I wanted to get this fix out quickly.

Best,

Joe

8/5/2008 7:41:31 AM
Gravatar
Total Posts 40

Re: Medium trust issue?

Hi Joe,

Thanks for that, I've given it a quick check on a test site and everything looks to be working fine. I'm about to upgrade my old sites now with the updates.

Many thanks,
Matt

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