Comments (6)
It looks like it can't connect to the named db server at all. Make sure you have the appropriately named instance of LocalDB on your machine. In my case, I have several:
You should be able to pick anything, as long as you have it installed. Can you confirm you have one called (localdb)/ProjectsV13 ?
from eshoponweb.
You mention that you have SQL Server 2014 installed, but do you have SQL Server Express installed as well? I believe localdb uses SQL Server Express, usually installed with Visual Studio. You can point the connection strings to your existing SQL Server but you'd have to create the databases on the server first.
from eshoponweb.
@ardalis @yarrgh thanks for the quick response!
I have SQL Server Express 2016 installed as well as SSMS 2014. I have been using localdb for my other projects. I've tried modifying my connection strings multiple times, testing out different servers and databases, including (localdb)\ProjectsV13
and (localdb)\MSSQLLocalDB
with no luck.
Just tried the following connection strings:
"ConnectionStrings": {
"CatalogConnection": "Data Source=DESKTOP-HICGBT3\\\\SQLEXPRESS01;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False;Initial Catalog=Microsoft.eShopOnWeb.CatalogDb;User=DESKTOP-HICGBT3\\Danny",
"IdentityConnection": "Data Source=DESKTOP-HICGBT3\\\\SQLEXPRESS01;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False;Initial Catalog=Microsoft.eShopOnWeb.Identity;User=DESKTOP-HICGBT3\\Danny"
}
which generated these new errors: https://gist.github.com/DannyAllegrezza/89232ac7aa17969cb0342343b131b439
from eshoponweb.
Closing this issue.
So I'm not really sure which fixed the problem, but I took these steps:
- Delete the existing migrations, see if I could recreate them.
At first, this did not work. I received the following error:
An error occurred while calling method 'BuildWebHost' on class 'Program'. Continuing without the application service provider. Error: One or more errors occurred. (Instance failure.)
Unable to create an object of type 'AppIdentityDbContext'. Add an implementation of 'IDesignTimeDbContextFactory<AppIdentityDbContext>' to the project, or see https://go.microsoft.com/fwlink/?linkid=851728 for additional patterns supported at design time.
Googling the error led me to this StackOverflow post which mentions how the seed data could cause an issue.
- I commented out the lines below
//Seed Data
inConfigureProduction()
andConfigureDevelopment()
which looked like:
//Seed Data
CatalogContextSeed.SeedAsync(app, catalogContext, loggerFactory)
.Wait();
var defaultUser = new ApplicationUser { UserName = "[email protected]", Email = "[email protected]" };
userManager.CreateAsync(defaultUser, "Pass@word1").Wait();
Aside: Where do these methods get called from? I tried to view the call hierarchy and did not see where they are called from...?
- After commenting out the seed data, I was able to run the create migration commands successfully.. finally!
λ dotnet ef migrations add InitialIdentityModel --context appidentitydbcontext -p ../Infrastructure/Infrastructure.csproj -s Web.csproj -o Identity/Migrations
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
User profile is available. Using 'C:\Users\Danny\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
info: Microsoft.EntityFrameworkCore.Infrastructure[100403]
Entity Framework Core 2.0.0-rtm-26452 initialized 'AppIdentityDbContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer' with options: None
Done. To undo this action, use 'ef migrations remove'
λ dotnet ef migrations add InitialModel --context catalogcontext -p ../Infrastructure/Infrastructure.csproj -s Web.csproj -o Data/Migrations
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
User profile is available. Using 'C:\Users\Danny\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
info: Microsoft.EntityFrameworkCore.Infrastructure[100403]
Entity Framework Core 2.0.0-rtm-26452 initialized 'CatalogContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer' with options: None
Done. To undo this action, use 'ef migrations remove'
Then I was able to run the dotnet ef database update
commands which successfully created the databases. After this, I uncommented the seed functionality and started up the application, which is now working for me.
from eshoponweb.
Are you running on the latest version of the master branch? The seed data thing is a known EF Core 2.0 breaking change that was fixed in the latest version of the sample. The seed data is now done in Program.cs:
https://github.com/dotnet-architecture/eShopOnWeb/blob/master/src/Web/Program.cs#L18-L36
If you were still seeing it in Startup.cs I think you were on an older version.
from eshoponweb.
Oh man, I was behind by like 17 commits. Glad to know about the seed data thing. I appreciate all of the help @ardalis 👍
btw: I've really enjoyed all of your PluralSight courses. Great stuff!
from eshoponweb.
Related Issues (20)
- OBE
- Verify devcontainer for codespaces debugging HOT 6
- Modernize to .NET SDK Containers
- Inconsistent naming of async methods HOT 1
- How to connect to the postgres instance from the host ? HOT 1
- Shopify manager HOT 2
- public api get catalog brands throws error HOT 1
- How to debug this project using VS Code? HOT 1
- Architect Modern Web Applications edition 7th not available as PDF HOT 2
- incorrect about section in github description HOT 1
- Inject IHttpContextAccessor to CatalogContext's constructor will be destoryed when RevokeAuthenticationEvents.cs handle about CatalogContext's data
- The style class prefix "col-xs-*" didnt work in cshtml files. HOT 1
- Changelog for the latest version, updated to .NET 7, is not available in the wiki page HOT 4
- Update to bootstrap 5
- .NET 8 Updates HOT 5
- Facing issue when deploying the application on azure app service HOT 2
- I am not able to deploy the application to Azure from Visual Studio Code HOT 1
- I'm not able to update in memory database HOT 1
- Update NuGet packages to latest versions HOT 1
- Revalidate AZD HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eshoponweb.