asp.net - 单声道与 SQL Server 成员资格提供程序?

标签 asp.net mono asp.net-membership

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

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

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>

文件顶部 /usr/local/etc/mono/4.0/settings.map在一台 Debian Linux 机器上是:
<?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>
<!-- ... -->

最佳答案

关于 ASP.NET Settings Mapping您链接到的页面,在标题为“禁止设置映射”的部分中,它说添加:

<appSettings>
  <add key="MonoAspnetInhibitSettingsMap" value="anything"/>
</appSettings>

到您的应用程序的 Web.config文件将禁用设置映射。然而,我发现“任何东西”这个值都不起作用。如果我改用值“true”,那么它会:
<appSettings>
  <add key="MonoAspnetInhibitSettingsMap" value="true"/>
</appSettings>

关于asp.net - 单声道与 SQL Server 成员资格提供程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3846487/

相关文章:

c# - 如何在我的 ASP.NET MVC 应用程序中附加自定义成员资格提供程序?

ASP.NET MembershipUserCollection 按 IsApproved、Comment 排序

c# - ASP C# : Special characters: #, $,+ 无法通过 URL 参数

c# - ASP.net 在服务引用之间重用类型

asp.net-mvc-3 - ASP.NET 成员(member)资格 - 登录在本地有效,但在 Azure 上失败

从范围 block 分配返回值的 C 变量?

c# - CS1703 : In Xamarin. Droid,我应该使用位于 Mono.Framework 或 System.Runtime 中的 .Net Standard windowsruntime.dll?

c# - 使用 C# 的 Google Analytics API

javascript - 如何使用 jquery 或 javascript 设置 asp 面板高度?

c# - 在使用 Mono 运行的 C# 应用程序中更改当前 Linux 用户?