简体   繁体   English

Microsoft WebMatrix 示例模板的成员资格提供程序名称和类型

[英]Membership provider name and type for Microsoft WebMatrix's sample Template

What is the membership provider name and type is used in the Microsoft Webmatrix's template site? Microsoft Webmatrix 的模板站点中使用的成员资格提供程序名称和类型是什么? In the web.config it is not given.在 web.config 中没有给出。 When I run it locally, the template works but when I publish, it gives the following error:当我在本地运行它时,模板可以工作,但是当我发布时,它会给出以下错误:

Parser Error Message: The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty.解析器错误消息:在应用程序配置中找不到连接名称“LocalSqlServer”或连接字符串为空。

Source Error:源错误:

Line 239:      <providers>
Line 240:        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, .... 

Source File: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config Line: 240源文件:C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config 行:240

Any help will be appreciated.任何帮助将不胜感激。

The Database used in the application is SQLCE4.应用程序中使用的数据库是 SQLCE4。

I don't believe there's a default Membership provider that supports SQL Server Compact Edition 4. There is a Membership provider implementation that does out on CodePlex: http://sqlcemembership.codeplex.com/我不相信有支持 SQL Server Compact Edition 4 的默认会员提供程序。 CodePlex 上一个会员提供程序实现: http://sqlcemembership.codeplex.com/

So, if you're using that already, then ensure that you have a connection string defined in your config file, like so:因此,如果您已经在使用它,请确保您在配置文件中定义了连接字符串,如下所示:

<connectionStrings>
  <add name="LocalSqlServer" 
       connectionString="data source=|DataDirectory|\YourDatabaseName.sdf"/>
</connectionStrings>

And your provider specified in your config should define the connectionStringName attribute and reference the connection string's name defined in the <connectionStrings> block, like this:并且您在配置中指定的提供程序应定义connectionStringName属性并引用<connectionStrings>块中定义的连接字符串的名称,如下所示:

<providers>
  <clear/>
  <add name="SqlCeMembershipProvider" 
       type="ErikEJ.SqlCeMembershipProvider" 
       connectionStringName="LocalSqlServer" 
       .... />
</providers>

A config sample is provided with that SQL CE 4 Membership provider on the main project page . SQL CE 4 Membership provider 在主项目页面上提供了一个配置示例。

Web Pages uses the SimpleMembershipProvider which is located in WebMatrix.WebData . Web 页面使用位于WebMatrix.WebData中的SimpleMembershipProvider

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM