Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Unable to locate a local database runtime Installation

$
0
0

I am using container in Docker with asp.net core 3.1.  I have one solution with projects on it and one of those is the library where database models using EF Core resides that is reference to the web app and the other one is the Web App project.

when I run the web app project I got the error that it cannot find my localdb. However, if I will not use docker it will just run fine and able to connect to the database.
My approach is I saw this while I was googling,  I override the  LaunchSettings  with this

"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_URLS": "https://+:443;http://+:80",
"ASPNETCORE_HTTPS_PORT": "44330",
"ConnectionStrings:DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=SBEDB;Trusted_Connection=True;MultipleActiveResultSets=true"
},
"httpPort": 10000,
"useSSL": true,
"sslPort": 44330
}

but no luck.

Here is my DockerFile

#escape=`
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
#Depending on the operating system of the host machines(s) that will build or run the containers, the image specified in the FROM statement may need to be changed.
#For more information, please see https://aka.ms/containercompat
FROM mcr.microsoft.com/powershell:nanoserver-1903 AS downloadnodejs
SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop';$ProgressPreference='silentlyContinue';"]
RUN Invoke-WebRequest -OutFile nodejs.zip -UseBasicParsing "https://nodejs.org/dist/v10.16.3/node-v10.16.3-win-x64.zip"; `
Expand-Archive nodejs.zip -DestinationPath C:\; `
Rename-Item "C:\node-v10.16.3-win-x64" c:\nodejs

FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-nanoserver-1903 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
COPY --from=downloadnodejs C:\nodejs\ C:\Windows\system32\

FROM mcr.microsoft.com/dotnet/core/sdk:3.1-nanoserver-1903 AS build
COPY --from=downloadnodejs C:\nodejs\ C:\Windows\system32\
WORKDIR /src
COPY ["SBE.Management.Funds/SBE.Management.Funds.csproj", "SBE.Management.Funds/"]
COPY ["SBE.Management.Funds.Services/SBE.Management.Funds.Services.csproj", "SBE.Management.Funds.Services/"]
COPY ["SBE.Management.Funds.Repositories/SBE.Management.Funds.Repositories.csproj", "SBE.Management.Funds.Repositories/"]
COPY ["SBE.Management.Funds.Base/SBE.Management.Funds.Base.csproj", "SBE.Management.Funds.Base/"]
COPY ["SBE.Management.Funds.Core/SBE.Management.Funds.Core.csproj", "SBE.Management.Funds.Core/"]
RUN dotnet restore "SBE.Management.Funds/SBE.Management.Funds.csproj"
COPY . .
WORKDIR "/src/SBE.Management.Funds"
RUN dotnet build "SBE.Management.Funds.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "SBE.Management.Funds.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "SBE.Management.Funds.dll"]




What did I missed? 
Thanks


Viewing all articles
Browse latest Browse all 9386

Trending Articles



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