简体   繁体   中英

Why won't Visual Studio Create Database?

I started into this book "Beginning ASP.NET MVC 4" by Jose Rolando Guay Paz and hit a problem straight away. According to the book, once you've created an mvc 4 internet application and run the default template and select the log-in link from the UI , then stop debugging this should create a LocalDB. When I select "Log-in", I'm met with the following...Server error in '\\' application

  CREATE DATABASE permission denied in database 'master'.

According the error page (yellow screen of death), its the below line in InitializeSimpleMemebershipAttribute.cs

  ((IObjectContextAdapter)context).ObjectContext.CreateDatabase();

In Visual studio the following is highlighted in InitializeSimpleMemebershipAttribute.cs

  LazyInitializer.EnsureInitialized(ref _initializer, ref _isInitialized, ref _initializerLock);

and the connected message - Exception has been thrown by the target of an invocation. InnerException - The ASP.NET Simple Membership database could not be initialized.

Its a mvc 4 application running on Visual Studio 2010 on a windows xp machine, this machine is on a network if that makes any difference. I am familiar with MVC , but mainly the front end , so I'm trying to get clued up on the database creation/connection side of the it.

Web Config connection string...

 <add name="DefaultConnection" connectionString="server=LP-58\SQLEXPRESS;database=HaveYouSeenMe-20140203145852;Integrated Security=sspi" providerName="System.Data.SqlClient" />

Tried this one as well but no joy...

  <add name="DefaultConnection" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=aspnet-HaveYouSeenMe-20140203145852;Integrated Security=SSPI" providerName="System.Data.SqlClient" /> 

I'm sure it's something simple but I can't seem to get it, so if I don't ask at this point I'll just me wasting more time, any help is appreciated

One of the names listed under logins was actually mine but had the last machine users name listed.

It was only when clicking on the name and selecting properties that I discovered the log-in name listed was mine.

So a rename of the The name listed in the logins folder listings corrected the error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM