[Mono-dev] mod_mono issues on 1.2.6

Marek Habersack grendello at gmail.com
Mon Dec 17 12:37:22 EST 2007

On Mon, 17 Dec 2007 12:09:53 -0500, "Joe Audette" <joe.audette at gmail.com>

> Hi All,
Hey Joe,
> First issue encountered was an invalid param exception thrown from
> mscorelib on the setup page. The line of code throwing the exception
> is testing for writability in the Data subfolder beneath the site
> root.
> The code that threw the exception is:
> public static void TouchTestFile(String pathToFile)
>         {
>             if (pathToFile != null)
>             {
>                 if (File.Exists(pathToFile))
>                 {
>                    // exception thrown here from mscorelib
>                     File.SetLastWriteTimeUtc(pathToFile, DateTime.Now);
>                 }
>                 else
>                 {
>                     StreamWriter streamWriter = File.CreateText(pathToFile);
>                     streamWriter.Close();
>                 }
>             }
>         }
> By deleting the files I was able to get past this as it hit the else clause.
As far as System.Web goes, it doesn't really matter whether it runs under
xsp or mod_mono - the latter is just a proxy and the backend code is the same
in both cases. What is different, though, is the environment created and
exposed to mod_mono by Apache - file permissions, chroot/no chroot, environment
variables, umask etc. Those factors may affect the behavior of the code running
in an application but they not always might be symptoms of a bug in Mono. In
this particular case it might be a matter of file permissions.
> Next error was it could not connect to the database. The cause of this
> error is that under mod_mono its not picking up my user.config file
> which has the correct connection string. It works fine from the
> command line with xsp2.
> My connection string is from appSettings section defined in Web.config
> to use user.config for overrides like this:
> <appSettings file="user.config">
> ...
> </appSettings>
> under mod_mono its not picking up my overrides in user.config as it should
Can you attach to the mod-mono-server2 backend process with strace before you
access the website for the first time and see whether it finds the include file
at all? You are using a relative path, and the file is read without mapping it
to the current appdomain's base directory, so if the current working directory
is different to the one where your user.config files, the file will be silently
ignored (see
class/System.Configuration/System.Configuration/AppSettingsSection.cs:73). If
the CWD is indeed different to the app's root directory then it might be a Mono
bug. The only question would be if it is a bug in System.Web/Mono.WebServer
which fails to set the cwd to the appdomain's root, or a bug in the appdomain
setup code in corlib which fails to do the same.

> so I put the correct connection string directly in Web.config and was
> able to get past the db connection problem
> Then I'm back to the same problem about setting the write time of
> files but this time with cache files. Stack trace below:
> System.IO.IOException: Invalid parameter
>   at System.IO.File.SetLastWriteTime (System.String path, DateTime
> last_write_time) [0x00000]
>   at System.IO.File.SetLastWriteTimeUtc (System.String path, DateTime
> last_write_time) [0x00000]
>   at mojoPortal.Business.WebHelpers.CacheHelper.TouchCacheFile
> (System.String pathToCacheFile) [0x00000]
>   at mojoPortal.Business.WebHelpers.CacheHelper.TouchMenuCacheDependencyFile
> () [0x00000]
>   at mojoPortal.Business.WebHelpers.CacheHelper.GetMenuPagesFromCache
> () [0x00000]
>   at mojoPortal.Business.WebHelpers.CacheHelper.GetMenuPagesFromContext
> () [0x00000]
>   at mojoPortal.Business.WebHelpers.CacheHelper.GetMenuPages () [0x00000]
>   at mojoPortal.Web.mojoSiteMapProvider.BuildSiteMap () [0x00000]
>   at mojoPortal.Web.mojoSiteMapProvider.GetRootNodeCore () [0x00000]
>   at System.Web.SiteMapProvider.get_RootNode () [0x00000]
>   at System.Web.UI.WebControls.SiteMapDataSource.GetStartNode
> (System.String viewPath) [0x00000]
>   at System.Web.UI.WebControls.SiteMapDataSource.GetHierarchicalView
> (System.String viewPath) [0x00000]
>   at
> System.Web.UI.HierarchicalDataSourceControl.System.Web.UI.IHierarchicalDataSource.GetHierarchicalView
> (System.String viewPath) [0x00000] at
> System.Web.UI.WebControls.HierarchicalDataBoundControl.GetData (System.String
> viewPath) [0x00000] at System.Web.UI.WebControls.TreeView.PerformDataBinding
> () [0x00000] at
> System.Web.UI.WebControls.HierarchicalDataBoundControl.PerformSelect ()
> [0x00000] at System.Web.UI.WebControls.BaseDataBoundControl.DataBind ()
> [0x00000] at System.Web.UI.WebControls.TreeView.DataBind () [0x00000]
>   at mojoPortal.Web.UI.SiteMenu.RenderTreeView () [0x00000]
>   at mojoPortal.Web.UI.SiteMenu.PopulateControls () [0x00000]
>   at mojoPortal.Web.UI.SiteMenu.Page_Load (System.Object sender,
> System.EventArgs e) [0x00000]
>   at System.Web.UI.Control.OnLoad (System.EventArgs e) [0x00000]
>   at System.Web.UI.Control.LoadRecursive () [0x00000]
>   at System.Web.UI.Control.LoadRecursive () [0x00000]
>   at System.Web.UI.Control.LoadRecursive () [0x00000]
>   at System.Web.UI.Control.LoadRecursive () [0x00000]
>   at System.Web.UI.Control.LoadRecursive () [0x00000]
>   at System.Web.UI.Page.InternalProcessRequest () [0x00000]
>   at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext
> context) [0x00000]
strace should help here as well - I suspect it's, again, a file permission
issue of some sort.

best regards,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20071217/92cc3092/attachment.bin 

More information about the Mono-devel-list mailing list