加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net – 具有SQL Server成员资格提供程序的Mono?

发布时间:2020-12-16 09:58:55 所属栏目:asp.Net 来源:网络整理
导读:显然,Mono使用sqlite成员资格提供程序替换对SQL Server成员资格提供程序的引用(请参阅 ASP.NET_Settings_Mapping).有没有办法说服Mono使用SQL Server作为成员资格提供者? 当我尝试登录我的网络应用程序时,我得到以下内容: System.Configuration.Provider.P
显然,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,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>

一台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,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,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>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读