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

console app default db connection (there is a bug)

$
0
0

Hi,

I am studying asp.net core (code first). My vs 2017 version 15.5.5

I dont use connection string for default. My windows user name "USER". 

'C:\Users\USERNorthwindEFCodeFirst.Contexts.NorthwindContext.mdf'. There is no slash "/" between 'C:\Users\USER and project name. so I have a error about "Access is denied" 

error

System.Data.SqlClient.SqlException: 'CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file 'C:\Users\USERNorthwindEFCodeFirst.Contexts.NorthwindContext.mdf'.
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.'

using NorthwindEFCodeFirst.Entities;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NorthwindEFCodeFirst.Contexts
{
    public class NorthwindContext: DbContext
    {
        public DbSet Customers { get; set; }
        public DbSet Orders { get; set; }
    }
}


Viewing all articles
Browse latest Browse all 9386

Trending Articles



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