Error creating SQL Server Express database file automatically in MVC 4 - But I DO NOT want to use SQL Server Express

I just deployed a new application in ASP.Net MVC 4. I am using SQL Server 2008 R2 (NOT SQL Express).

It worked well for the first 10 minutes, then I changed the code a bit and redeployed it.

Now when I try to access a page using SimpleMembership, I get this error:

When connecting to SQL Server, a network-related or specific instance error occurred. The server was not found or was not available. Verify the instance name is correct and configure SQL Server to connect remotely. (provider: SQL network interfaces, error: 26 - server / instance location error)

Description: An unhandled exception occurred during the execution of the current web request. Check the stack trace for more information about the error and where it appeared in the code.

Error creating SQLExpress database file automatically:
The connection string indicates the local Sql Server Express instance using the database location in the App_Data application directory. The provider attempted to automatically create the application services database because the provider determined that the database does not exist. The following configuration requirements are required to successfully verify the availability of the application services database and automatically create the application services database:

But I do not use SQL Server Express. In mine, web.configI set all the connection strings as follows:

<add name="ApplicationServices" 
     connectionString="Server=myServer;Database=myDB;User Id=myUserID;Password=myPWD;" 
     providerName="System.Data.SqlClient" />

<add name="ApplicationServices" 
     connectionString="Server=myServer;Database=myDB;User Id=myUserID;Password=myPWD;" 
     providerName="System.Data.SqlClient" />

SQL Server EXPRESS?

+5
2

? , ApplicationServices, ?

. config web.config .

<membership defaultProvider="AspNetSqlMembershipProvider">
  <providers>
    <clear />
    <add name="AspNetSqlMembershipProvider"
         type="System.Web.Security.SqlMembershipProvider"
         connectionStringName="ApplicationServices"
         enablePasswordRetrieval="false"
         enablePasswordReset="true"
         requiresQuestionAndAnswer="false"
         requiresUniqueEmail="false"
         maxInvalidPasswordAttempts="5"
         minRequiredPasswordLength="6"
         minRequiredNonalphanumericCharacters="0"
         passwordAttemptWindow="10"
         applicationName="Test" />
  </providers>
</membership>
<roleManager enabled="true" defaultProvider="SqlRoleManager">
  <providers>
    <add name="SqlRoleManager"
         type="System.Web.Security.SqlRoleProvider"
         connectionStringName="ApplicationServices"
         applicationName="Test" />
  </providers>
</roleManager>
+4

, . , , , _Layout.cshtml User.IsInRole("role"), Request.isAuthenticated. @if (Request.isAuthenticated && User.IsInRole("role")). , , , , IsInRole() ( , , , . , , , _Layout , [InitializeSimpleMembership]. .

-

namespace ProjectName.Controllers
{
    [InitializeSimpleMembership]
    public class HomeController : Controller {
...

, Ctrl + F5, , "Rebuild Solution" . , root, , . .

, -. .

+4

All Articles