[Mono-list] System.Web.Security.Membership causes an exception on mono platform

Gonzalo Paniagua Javier gonzalo.mono at gmail.com
Sun Jan 18 00:17:34 UTC 2015


Hi Olli,

Your MonoApplications line is:
   MonoApplications boacommander "/boacommander:/var/www/html/boacommander"

So there is no ASP.NET application configured for /, which is the error you
are seeing.
A possible fix is to change that to read:
  MonoApplications boacommander "/:/var/www/html/boacommander"

Or set up something else on / that just redirects to /boacommander.

-Gonzalo



On Sat, Jan 17, 2015 at 2:20 AM, Olli Heiskanen <
ohjelmistoarkkitehti at gmail.com> wrote:

> Hello,
>
> A little more information on this:
>
> The actual problem is an error that says "Failed to map path '/'", that is
> what I get in an inner exception:
>
> System.InvalidOperationException
> Failed to map path '/'
>
>  at System.Web.HttpRequest.MapPath (System.String virtualPath,
> System.String baseVirtualDir, Boolean allowCrossAppMapping) [0x001a4] in
> /usr/local/src/mono/mcs/class/System.Web/System.Web/HttpRequest.cs:1563
>   at System.Web.HttpRequest.MapPath (System.String virtualPath) [0x0000d]
> in /usr/local/src/mono/mcs/class/System.Web/System.Web/HttpRequest.cs:1520
>   at System.Web.Hosting.HostingEnvironment.MapPath (System.String
> virtualPath) [0x00042] in
> /usr/local/src/mono/mcs/class/System.Web/System.Web.Hosting/HostingEnvironment.cs:156
>   at System.Web.Hosting.DefaultVirtualPathProvider.DirectoryExists
> (System.String virtualDir) [0x00016] in
> /usr/local/src/mono/mcs/class/System.Web/System.Web.Hosting/DefaultVirtualPathProvider.cs:59
>   at System.Web.Configuration.WebConfigurationManager.FindWebConfig
> (System.String path, System.Boolean& inAnotherApp) [0x0001a] in
> /usr/local/src/mono/mcs/class/System.Web/System.Web.Configuration_2.0/WebConfigurationManager.cs:592
>   at System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration
> (System.String path, System.String site, System.String locationSubPath,
> System.String server, System.String userName, System.String password,
> Boolean fweb) [0x00026] in
> /usr/local/src/mono/mcs/class/System.Web/System.Web.Configuration_2.0/WebConfigurationManager.cs:360
>   at System.Web.Configuration.WebConfigurationManager.GetSection
> (System.String sectionName, System.String path, System.Web.HttpContext
> context) [0x0000d] in
> /usr/local/src/mono/mcs/class/System.Web/System.Web.Configuration_2.0/WebConfigurationManager.cs:456
>   at System.Web.Configuration.WebConfigurationManager.GetSection
> (System.String sectionName, System.String path) [0x00000] in
> /usr/local/src/mono/mcs/class/System.Web/System.Web.Configuration_2.0/WebConfigurationManager.cs:435
>   at System.Web.Security.SqliteMembershipProvider.Initialize
> (System.String name, System.Collections.Specialized.NameValueCollection
> config) [0x0028b] in
> /usr/local/src/mono/mcs/class/System.Web/System.Web.Security/SqliteMembershipProvider.cs:143
>   at System.Web.Configuration.ProvidersHelper.InstantiateProvider
> (System.Configuration.ProviderSettings providerSettings, System.Type
> providerType) [0x00069] in
> /usr/local/src/mono/mcs/class/System.Web/System.Web.Configuration_2.0/ProvidersHelper.cs:61
>   at System.Web.Configuration.ProvidersHelper.InstantiateProviders
> (System.Configuration.ProviderSettingsCollection configProviders,
> System.Configuration.Provider.ProviderCollection providers, System.Type
> providerType) [0x0003e] in
> /usr/local/src/mono/mcs/class/System.Web/System.Web.Configuration_2.0/ProvidersHelper.cs:72
>
>
>
> My Web.config does not have any custom stuff, other than a custom
> membership provider, but the same error occurs on a fresh mvc3 site without
> any added code or customizations.
>
> My apache/mod_mono configuration is directly from
> http://go-mono.com/config-mod-mono/, without any change, here it is:
>
> Alias /boacommander "/var/www/html/boacommander"
>   MonoServerPath boacommander "/usr/bin/mod-mono-server4"
>   MonoDebug boacommander true
>   MonoSetEnv boacommander MONO_IOMAP=all
>   MonoApplications boacommander "/boacommander:/var/www/html/boacommander"
>   <Location "/boacommander">
>     Allow from all
>     Order allow,deny
>     MonoSetServerAlias boacommander
>     SetHandler mono
>     SetOutputFilter DEFLATE
>     SetEnvIfNoCase Request_URI "\.(?:gif|jpe?g|png)$" no-gzip dont-vary
>   </Location>
>   <IfModule mod_deflate.c>
>     AddOutputFilterByType DEFLATE text/html text/plain text/xml
> text/javascript
>   </IfModule>
>
>
> I have observed this error on mono versions 3.10.0, 3.10.1 and 3.12.0, all
> compiled from git branches.
>
>
> Based on my searches for a solution, I've seen some posts where this error
> occurs on a windows platform and a workaround is to run Visual Studio as
> administrator. This is not what I can do as the error does not occur on my
> windows platform, and apache process is run as root.
>
> Still I feel this might be a configuration issue, as it has something to
> do with path mapping. So far though, I've not found a configuration change
> that would solve the issue.
>
> cheers,
> Olli
>
>
>
>
> 2015-01-13 17:50 GMT+02:00 Olli Heiskanen <ohjelmistoarkkitehti at gmail.com>
> :
>
>>
>> Hello,
>>
>> I'm trying to deploy a MVC3 site on a CentOS server using mono and
>> mod_mono on apache. After a week of agonizing installations and
>> configurations, I got the site up, but a MembershipProvider still acts up.
>> My mono version is 3.10.0, installed from source and got from a git branch.
>>
>> While the code works fine on a windows machine, in a mono environment I
>> get an exception while trying to log in, at the row below:
>> if (Membership.ValidateUser(userid, password))
>>
>> The exception message is:
>> An exception was thrown by the type initializer for
>> System.Web.Security.Membership
>>
>> The stack trace does not tell much:
>>   at boa.BoaCommander.Controllers.AccountController.VerifyUser
>> (System.String userid, System.String password, Boolean rememberme)
>> [0x00000] in <filename unknown>:0
>>
>> In my Web.config I have the membership provider defined like this:
>> <membership defaultProvider="BoaMembershipProvider">
>>   <providers>
>> <add name="BoaMembershipProvider"
>> type="BoaCommander.Providers.BoaMembershipProvider"
>> connectionStringName="BoaMySqlConnection" applicationName="BOA"
>> passwordFormat="Hashed"/>
>>   </providers>
>> </membership>
>>
>> ... and the class BoaMembershipProvider inherits MembershipProvider.
>>
>> What can I do to fix this problem? I'd appreciate Your comments.
>>
>> cheers,
>> Olli
>>
>
>
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20150117/4ad1568f/attachment-0001.html>


More information about the Mono-list mailing list