asp.net.netsql-serversqlmembershipprovidersql-server-2014-express

Partial connection to SQL Server 2014 Express


Firstly, this is not a repeat of the same old:

provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified.

Here's the scenario. I'm using ASP.NET membership with a SQLMembershipProvider. This used to work fine, however since a clean install on my development machine and upgrading to SQL Server 2014 Express, I'm now experiencing a strange issue.

When I run the website I get the login form. If I enter an incorrect username and password I get the normal message "invalid username/password". If I enter the correct username / password I get the error 26 as above. I can successfully connect to the database using the same connection string in SQL Server Management Studio, just not from within my ASP.NET Web App.

Connection String:

<connectionStrings> 
   <add name="WEBConnectionString"
        connectionString="Server=SERSQL01\SQLEXPRESS;Initial Catalog=WEBAPP;User ID=MyLogin;Password=MyPassword"         
        providerName="System.Data.SqlClient"
   />
</connectionStrings>

Things I have checked:

Environment:


Solution

  • Finally found the problem.

    I was using a custom sql membership provider. But I hadn't extended the role provider:

    <roleManager enabled="true" defaultProvider="SqlProvider" >
            <providers>
                <clear/>
                <add name="SqlProvider" type="System.Web.Security.SqlRoleProvider"
                  connectionStringName="WEBConnectionString" applicationName="/" />
            </providers>
        </roleManager>