代码之家  ›  专栏  ›  技术社区  ›  Matthew Talbert

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

  •  4
  • Matthew Talbert  · 技术社区  · 14 年前

    显然,mono将对SQL Server成员资格提供程序的引用替换为sqlite成员资格提供程序(请参见 ASP.NET_Settings_Mapping )有没有办法说服Mono使用SQL Server作为成员资格提供程序?

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

    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>
    <!-- ... -->
    
    2 回复  |  直到 14 年前
        1
  •  3
  •   Daniel Trebbien    14 年前

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

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

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

    <appSettings>
      <add key="MonoAspnetInhibitSettingsMap" value="true"/>
    </appSettings>
    
        2
  •  1
  •   rene    14 年前

    这一定是配置错误,因为Mono2.0存在已实现的sqlMembershipProvider。它正在使用DBProviderFactory获取连接。还有一个sqlclient实现,这样只会得出网站的web.config不正确的结论,这是不可想象的,因为sqlclient和sqlite在过于拥挤的web.config中看起来几乎相同。

    如果有人能发表这篇文章,那就可以澄清手头的问题。