1

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:

  • Instance name is correct.
  • Firewall is disabled.
  • Remote connections are enabled.
  • TCP/IP enabled, port 1433.
  • SQL Browser Enabled.
  • Mixed mode authentication is enabled.
  • Telnet connects successfully.
  • SSSM connects successfully.

Environment:

  • Development Machine: Windows 8.1 with Visual Studio 2013
  • Server: SQL Server 2014 Express on Windows Server 2012 R2
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Reafidy
  • 8,240
  • 5
  • 51
  • 83
  • 1
    `Initial Catalog=WEBAPP.MDF` ? Here you should have the logical database name, not the name of the MDF file – Steve Jul 27 '14 at 21:43
  • @Steve, thanks, somehow when I attached the database I incorrectly renamed it to "WEBAPP.MDF". I have renamed the database too "WEBAPP" and changed the connection string as above. The problem still exists. – Reafidy Jul 27 '14 at 21:52
  • @Steve, any other ideas? Still struggling with this one. – Reafidy Aug 05 '14 at 07:32
  • Sorry, no ideas. Not an expert in SqlMemberShipProvider. – Steve Aug 05 '14 at 08:17

1 Answers1

0

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>
Reafidy
  • 8,240
  • 5
  • 51
  • 83