0

I'm trying to use the "ASP.NET Universal Providers 1.2" from http://nuget.org/packages/System.Web.Providers using Visual Studio 2010 and Sql Server 2008

Everything works find on my local dev box. However, but when I go deploy the code to a DEV server, I get the following error when first hitting the web site (I have code in application start that creates default roles and a default membership user if not existing):

"The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty."

I've created sql script to create the SqlMembershipProvider tables (reversed engineered from a temp database when provider ran corrrectly locally). The correct tables are there and it works just fine using the main sql server instance on my dev box.

I'm unsure why its trying to use the old provider on the remote DEV server. I'm assuming its a permission error. On my dev box, I am an admin and was using integrated security. For the DEV server, I am using a SQL Server account (see connection string below), which as SELECT INSERT UPDATE DELETE perms on each of the SqlMembershipProvider tables. Are there more perms needed for a SQL Server account?

Here is the provider values from web.config

<profile defaultProvider="DefaultProfileProvider" enabled="true">
  <providers>
    <add name="DefaultProfileProvider"
      type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
      connectionStringName="MasterSqlClientConnectionString" applicationName="PortalDEV"/>
  </providers>
</profile>
<membership defaultProvider="DefaultMembershipProvider">
  <providers>
    <add name="DefaultMembershipProvider"
      type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
      applicationName="PortalDEV" connectionStringName="MasterSqlClientConnectionString" enablePasswordRetrieval="true" enablePasswordReset="true"
      requiresQuestionAndAnswer="true" requiresUniqueEmail="true" maxInvalidPasswordAttempts="3" minRequiredPasswordLength="8"
      minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordFormat="Encrypted"/>
  </providers>
</membership>
<roleManager defaultProvider="DefaultRoleProvider" enabled="true" cacheRolesInCookie="false" cookiePath="/" cookieProtection="All" cookieRequireSSL="true"
  cookieSlidingExpiration="true" cookieTimeout="16" maxCachedResults="25">
  <providers>
    <add name="DefaultRoleProvider"
      type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
      connectionStringName="MasterSqlClientConnectionString" applicationName="PortalDEV"/>
  </providers>
</roleManager>
<sessionState mode="InProc" customProvider="DefaultSessionProvider" compressionEnabled="true" timeout="16">
  <providers>
    <add name="DefaultSessionProvider"
      type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
  </providers>
</sessionState>

And here is my connection string (with data masked):

Any ideas?

Kevin Brown-Silva
  • 40,873
  • 40
  • 203
  • 237
Carl Prothman
  • 1,461
  • 13
  • 23
  • And here is my connection string (with data masked): – Carl Prothman Aug 23 '12 at 00:56
  • From Visual Studio 2010, if I select Project | ASP.NET Config menu, and then click the Security tab, I get the following error: There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. The following message may help in diagnosing the problem: The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty. (C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config line 238) – Carl Prothman Aug 23 '12 at 01:02
  • I also had issue with "ASP.NET Config". I just changed my connection name as "LocalSqlServer" and everything started to work. – marisks Aug 29 '12 at 14:22

1 Answers1

0

The trick was to add a "< clear / >" line at start of section in config file. ASP.NET Universal Providers 1.2 - "The connection name 'LocalSqlServer' was not found"

Community
  • 1
  • 1
Carl Prothman
  • 1,461
  • 13
  • 23