asp.net - Why is the SPA application not creating a database? -


i have followed microsoft video trying make single page application , doesnt create or connect sql instance though have other applications using code first. example connection string was...

<add name="defaultconnection" connectionstring="data source=localhost;initial catalog=aspnet-mvcapplication2-201265113324;integrated security=true" providername="system.data.sqlclient" /> 

but error saying

a network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections. (provider: sql network interfaces, error: 26 - error locating server/instance specified)

its strange because other application connectionstring...

<add name="ptedotnetcontext" providername="system.data.sqlclient" connectionstring="server=localhost;database=ptedotnet;trusted_connection=true;" /> 

works fine , connect no problem...

if not provide connection string or connection string name dbcontext constructor, try find connection name matches (inherited) dbcontext class name.

hence can either change name of connection string

<add name="mydbcontext" connectionstring="data source=localhost;initial catalog=aspnet-mvcapplication2-201265113324;integrated security=true" providername="system.data.sqlclient" /> 

or provide name of connection string in constructor

public class mydbcontext : dbcontext {      public mydbcontext() : base("defaultconnection") {} } 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -