That assembly does not allow partially trusted callers...

You get this exception when navigating to the page of successfully deployed application.

The Menu.sitemap file or master file do not exist.

That assembly does not allow partially trusted callers.

Or

The /_layouts/MyApp/Menu Panels/Menu.sitemap file required by XmlSitemapProvider does not exist.  The file /_layouts/MyApp/Master Pages/HorizontalMenu.master does not exist.

This could be result of insufficient permissions for the process which owns application to access menu or load certain providers in your application’s Web.config file, usually SharedServicesQuickLaunchProvider or AdministrationQuickLaunchProvider.  Such exceptions appear usually when the application is loaded the first time after application pool has been recycled.

Solution

Set your start page not to a specific page in your application (e.g.: AppName/Categories/ShowCategoriesTable.aspx) but rather to default.aspx page.  This page has special logic which first loads menu and default SharePoint master page and then redirects to the default page (which could be ShowCategoriesTable.aspx).  By doing that, all controls are being loaded under current permissions of the default master page and exception never happens. If you need to have different pages as start pages we recommend cloning default.aspx page and setting there different URLs as start page.  Although this solution works most of the time, in some SharePoint configuration it might not work always. If you see this problem, verify that your application runs properly and Application pool does not restart frequently because every time Application Pool is recycled application will load all dlls referenced in web.config again. (Check event logs on the server). Another approach is to remove these two providers’ references from the web.config or create new web application to host IronSpeed applications and modify its web.config.

See Also

Part VII:  Troubleshooting Applications

SharePoint Application Deployment Error Messages