Mono 与 SQL Server 会员资格提供程序?

Mat*_*ert 5 asp.net mono asp.net-membership

显然,Mono 用 sqlite 成员资格提供程序替换了对 SQL Server 成员资格提供程序的引用(请参阅ASP.NET_Settings_Mapping)。有什么方法可以说服 Mono 使用 SQL Server 作为会员资格提供者吗?

当我尝试登录我的网络应用程序时,我收到以下信息:

System.Configuration.Provider.ProviderException: Operation aborted due to an exception (see Trace for details).
at System.Web.Security.SqliteMembershipProvider.ValidateUser (string,string) <0x003bb>
at DirectMail.Controllers.AccountMembershipService.ValidateUser (string,string) [0x00000] in [file].cs:404
at DirectMail.Controllers.AccountController.ValidateLogOn (string,string) [0x00040] in [file].cs:346
at DirectMail.Controllers.AccountController.LogOn (string,string,bool,string) [0x00000] in [file].cs:79
at (wrapper dynamic-method) System.Runtime.CompilerServices.ExecutionScope.lambda_method (System.Runtime.CompilerServices.ExecutionScope,System.Web.Mvc.ControllerBase,object[]) <0x001c1>
at System.Web.Mvc.ActionMethodDispatcher.Execute (System.Web.Mvc.ControllerBase,object[]) <0x00028>
at System.Web.Mvc.ReflectedActionDescriptor.Execute (System.Web.Mvc.ControllerContext,System.Collections.Generic.IDictionary`2<string, object>) <0x0015b>
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod (System.Web.Mvc.ControllerContext,System.Web.Mvc.ActionDescriptor,System.Collections.Generic.IDictionary`2<string, object>) <0x00036>
at System.Web.Mvc.ControllerActionInvoker/<InvokeActionMethodWithFilters>c__AnonStoreyB.<>m__E () <0x00092>
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter (System.Web.Mvc.IActionFilter,System.Web.Mvc.ActionExecutingContext,System.Func`1<System.Web.Mvc.ActionExecutedContext>) <0x00125>
Run Code Online (Sandbox Code Playgroud)

一台 Debian Linux 机器上的文件顶部/usr/local/etc/mono/4.0/settings.map是:

<?xml version="1.0" encoding="utf-8" ?>
<settingsMap>
  <map sectionType="System.Web.Configuration.MembershipSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
       mapperType="Mono.Web.Util.MembershipSectionMapper, Mono.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"
       platform="Unix">

    <!-- The 'what' tag specifies which region of the section to modify. The 'value' attribute value is mapper-specific and is not defined here. It can be
         any expression understood by the mapper to designate the section region to modify.
    -->
    <what value="providers">
      <!-- 'what' can contain any number of occurrences of any three elements:
              replace - replace the designated region
        add - add a new entry to the region
        clear - clear the region
        remove - remove the designatedregion

              The attributes to any of the above are freeform and are not processed by the mapper manager. They are stored verbatim for the
        mapper to peruse.
      -->
      <replace name="AspNetSqlMembershipProvider" 
         type="System.Web.Security.SqliteMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
         connectionStringName="LocalSqliteServer" />
    </what>
  </map>
<!-- ... -->
Run Code Online (Sandbox Code Playgroud)

Dan*_*ien 4

在您链接到的ASP.NET 设置映射页面上标题为“禁止设置映射”的部分中,它表示添加:

<appSettings>
  <add key="MonoAspnetInhibitSettingsMap" value="anything"/>
</appSettings>
Run Code Online (Sandbox Code Playgroud)

添加到您的应用程序Web.config文件将禁用设置映射。然而,我发现“任何东西”的值都不起作用。如果我使用值“true”代替,那么它会:

<appSettings>
  <add key="MonoAspnetInhibitSettingsMap" value="true"/>
</appSettings>
Run Code Online (Sandbox Code Playgroud)