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

Martin Thwaites monoforum at my2cents.co.uk
Sat Jan 17 19:40:53 UTC 2015


Hi Olli,

I can't shed much light on the error itself, however, have you had any
asp.net site working on this installation?

Also, where was the site developed, VS, MD, Xs?

You say it happens on a fresh MVC site, what do you mean by fresh? A VS
template?

Also, have you tried disabling the Membership system altogether to see if
the error that's presented is masking something else?

I'll try to respond to further e-mails but I'm busy for the next few days.
Hopefully the answers to those questions will either get you to a solution
or enable somebody to help.

Thanks
Martin
On 17 Jan 2015 10:20, "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/3fcbb5b0/attachment.html>


More information about the Mono-list mailing list