简体   繁体   中英

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? In the web.config it is not given. 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.

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

Any help will be appreciated.

The Database used in the application is 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/

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:

<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 .

Web Pages uses the SimpleMembershipProvider which is located in WebMatrix.WebData .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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