Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Network error while updating database in Visual Studio nuget package manager

$
0
0

I was watching a tutorial on Blazor Wasm with cookie authentication and I'm getting this error after I ran update-database in the console.

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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server).

Are there any additional tools or programs I need to install on my machine or is this error related to my project? How can I solve this?

public class Program{      public static void Main(string[] args)      {          var builder = WebApplication.CreateBuilder(args);          // Add services to the container.          builder.Services.AddRazorComponents().AddInteractiveWebAssemblyComponents();          builder.Services.AddDbContext<ApplicationDbContext>(o =>              o.UseSqlServer(builder.Configuration.GetConnectionString("Default"))          );          builder              .Services.AddIdentity<ApplicationUser, IdentityRole>()              .AddEntityFrameworkStores<ApplicationDbContext>()              .AddSignInManager()              .AddDefaultTokenProviders();          var app = builder.Build();          // Configure the HTTP request pipeline.          if (app.Environment.IsDevelopment())          {              app.UseWebAssemblyDebugging();          }          else          {              app.UseExceptionHandler("/Error");              app.UseHsts();          }          app.UseHttpsRedirection();          app.UseStaticFiles();          app.UseAntiforgery();          app.MapRazorComponents<App>()              .AddInteractiveWebAssemblyRenderMode()              .AddAdditionalAssemblies(typeof(Client._Imports).Assembly);          app.Run();      }}

Project file:

<Project Sdk="Microsoft.NET.Sdk.Web"><PropertyGroup><TargetFramework>net8.0</TargetFramework><Nullable>enable</Nullable><ImplicitUsings>enable</ImplicitUsings></PropertyGroup><ItemGroup><ProjectReference Include="..\Safrim.Wasm.Client\Safrim.Wasm.Client.csproj" /><PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.6" /><PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.7" /><PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.7" /><PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.7"><PrivateAssets>all</PrivateAssets><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets></PackageReference></ItemGroup></Project>

Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>