si2030
asked on
Issues with the first ASP.NET MVC3 tutorial...
Hey there,
Rank Amature here... I have been working on the very first ASP.NET MVC3 on the Microsoft website.
http://www.asp.net/mvc/tutorials/getting-started-with-mvc3-part5-cs
I am I suppose halfway through and it has me constructing the controller having already created the model... its indicated that "EF Code-First" should have created the database automatically for me when I first run it... it hasnt. I am a bit lost as to why it didnt and I can only guess that its to do with the connection string. They indiciated I use the following i nthe web.config file...
<add name="MovieDBContext"
connectionString="Server=. \SQLEXPRES S;
Database=Movies;Trusted_Co nnection=t rue"
providerName="System.Data. SqlClient" />
Which I did. However when I look at Server Management Studio I note that my server is called (local). Why is it called (local) and is the reason it couldnt connect and thus not create the database.... I did create a default instance...
Kind Regards
Rank Amature here... I have been working on the very first ASP.NET MVC3 on the Microsoft website.
http://www.asp.net/mvc/tutorials/getting-started-with-mvc3-part5-cs
I am I suppose halfway through and it has me constructing the controller having already created the model... its indicated that "EF Code-First" should have created the database automatically for me when I first run it... it hasnt. I am a bit lost as to why it didnt and I can only guess that its to do with the connection string. They indiciated I use the following i nthe web.config file...
<add name="MovieDBContext"
connectionString="Server=.
Database=Movies;Trusted_Co
providerName="System.Data.
Which I did. However when I look at Server Management Studio I note that my server is called (local). Why is it called (local) and is the reason it couldnt connect and thus not create the database.... I did create a default instance...
Kind Regards
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I tried the changes in this case I changed the conection string to
Hi dhansmani,
Ok so I changed the connection string to (local) - see code area for web.config file etc
I got an error in the controller re the LINQ statement. The error is below.
I have also included the log on to SQL management Studio which shows what I have to enter to log on... thought by setting it to (local) it should work but doesnt...
The thing is its suppose to create the database and its not doing so I am guessing because it cant connect...
Kind Regards
Simon
System.Data.ProviderIncomp
Message=The provider did not return a ProviderManifestToken string.
Source=System.Data.Entity
StackTrace:
Server stack trace:
at System.Data.Common.DbProvi
at System.Data.Entity.ModelCo
at System.Data.Entity.ModelCo
at System.Data.Entity.Interna
at System.Lazy`1.CreateValue(
Exception rethrown at [0]:
at System.Data.Common.DbProvi
at System.Data.Entity.ModelCo
at System.Data.Entity.ModelCo
at System.Data.Entity.Interna
at System.Lazy`1.CreateValue(
at System.Lazy`1.LazyInitValu
at System.Lazy`1.get_Value()
at System.Data.Entity.Interna
at System.Data.Entity.Interna
at System.Data.Entity.Interna
at System.Data.Entity.Interna
at System.Data.Entity.Interna
at System.Data.Entity.Infrast
at System.Linq.Queryable.Wher
at MvcMovie.Controllers.Movie
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ActionMetho
at System.Web.Mvc.ReflectedAc
at System.Web.Mvc.ControllerA
at System.Web.Mvc.ControllerA
at System.Web.Mvc.ControllerA
InnerException: System.Data.SqlClient.SqlE
Message=A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Source=.Net SqlClient Data Provider
ErrorCode=-2146232060
Class=20
LineNumber=0
Number=-1
Server=""
State=0
StackTrace:
at System.Data.SqlClient.SqlI
at System.Data.SqlClient.TdsP
at System.Data.SqlClient.TdsP
at System.Data.SqlClient.SqlI
at System.Data.SqlClient.SqlI
at System.Data.SqlClient.SqlI
at System.Data.SqlClient.SqlI
at System.Data.SqlClient.SqlC
at System.Data.ProviderBase.D
at System.Data.ProviderBase.D
at System.Data.ProviderBase.D
at System.Data.ProviderBase.D
at System.Data.ProviderBase.D
at System.Data.ProviderBase.D
at System.Data.SqlClient.SqlC
at System.Data.SqlClient.SqlP
at System.Data.SqlClient.SqlP
at System.Data.SqlClient.SqlP
at System.Data.Common.DbProvi
InnerException:
System.Data.ProviderIncomp
Message=The provider did not return a ProviderManifestToken string.
Source=System.Data.Entity
StackTrace:
Server stack trace:
at System.Data.Common.DbProvi
at System.Data.Entity.ModelCo
at System.Data.Entity.ModelCo
at System.Data.Entity.Interna
at System.Lazy`1.CreateValue(
Exception rethrown at [0]:
at System.Data.Common.DbProvi
at System.Data.Entity.ModelCo
at System.Data.Entity.ModelCo
at System.Data.Entity.Interna
at System.Lazy`1.CreateValue(
at System.Lazy`1.LazyInitValu
at System.Lazy`1.get_Value()
at System.Data.Entity.Interna
at System.Data.Entity.Interna
at System.Data.Entity.Interna
at System.Data.Entity.Interna
at System.Data.Entity.Interna
at System.Data.Entity.Infrast
at System.Linq.Queryable.Wher
at MvcMovie.Controllers.Movie
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ActionMetho
at System.Web.Mvc.ReflectedAc
at System.Web.Mvc.ControllerA
at System.Web.Mvc.ControllerA
at System.Web.Mvc.ControllerA
InnerException: System.Data.SqlClient.SqlE
Message=A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Source=.Net SqlClient Data Provider
ErrorCode=-2146232060
Class=20
LineNumber=0
Number=-1
Server=""
State=0
StackTrace:
at System.Data.SqlClient.SqlI
at System.Data.SqlClient.TdsP
at System.Data.SqlClient.TdsP
at System.Data.SqlClient.SqlI
at System.Data.SqlClient.SqlI
at System.Data.SqlClient.SqlI
at System.Data.SqlClient.SqlI
at System.Data.SqlClient.SqlC
at System.Data.ProviderBase.D
at System.Data.ProviderBase.D
at System.Data.ProviderBase.D
at System.Data.ProviderBase.D
at System.Data.ProviderBase.D
at System.Data.ProviderBase.D
at System.Data.SqlClient.SqlC
at System.Data.SqlClient.SqlP
at System.Data.SqlClient.SqlP
at System.Data.SqlClient.SqlP
at System.Data.Common.DbProvi
InnerException:
Open in new window
log-on-sql.png