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

Olli Heiskanen ohjelmistoarkkitehti at gmail.com
Mon Jan 19 14:55:32 UTC 2015

Thanks a million for helping Martin, I've been stuck with this for a while
and really need to get something working, or at least ways to dig up more
information. I use VS for developing on a Win8 machine, on that everything
works perfectly.

And thank You Gonzalo for your suggestion, unfortunately changing
/boacommander to / had no effect on the errors. I have the default httpd
conf file, tried to disable file indexes by using Options -Indexes
FollowSymLinks setting under <Directory /> but removing -Indexes did not
have an effect on the errors.

Yes, a MVC3 site created from a VS template without any changes anywhere is
my "fresh site".

No, I haven't gotten any websites working, only a very simple empty web app
without any functionality. Tried a WebForms, MVC3 and MVC4 apps so far. A
simple empty web app without any functionality works fine.

On my MVC sites if I have an action link like:
@Html.ActionLink("About", "About", "Home")

this works fine, I can navigate between pages, but whenever I'm posting a
form, like registering a new user or logging in, I get the "Failed to map
path '/'" -error. This seems like an extremely crucial error.


2015-01-18 2:17 GMT+02:00 Gonzalo Paniagua Javier <gonzalo.mono at gmail.com>:

> 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/20150119/ea63c72b/attachment.html>

More information about the Mono-list mailing list