问题
net migrating from java in selfstudy mode.(visual studio 2019 community & SqlServer 2017 64bit community edition installed). I was following the instructions on this tutorial link
When I executed the step of initial migration step I encountered this error when i run update-database I'm encountering this error. I know its related to database access/ configuration problem I'd really appreciate the correct way to provide it to Package Manager Console.
I've added the allow service to interact with desktop permission in the service of SQL server. As well as went through the settings of nuget Package manager settings including SQL server tools where I didnt find any setting to add of test connection.
CREATE FILE encountered operating system error 5(Access is denied.) while >attempting to open or create the physical file >'C:\Users\userRazorPagesMovieContext-f0053713-d1d4-4b1b-b07a->c77d6dfaf131.mdf'. CREATE DATABASE failed. Some file names listed could not be created. Check >related errors.
回答1:
I got the solution Thank you @Oscar for the solution. This is the problem originated due to visual studio's default behavior of storing the all projects in C drive and folders. Best solution Store the project files in other drives other than the OS.
Temporary solution: just rightclick -> property -> security give write permission
update: its said that the problem arises with a bug in Sql server 2017 which is fixed in update
Cumulative Update 6 for SQL Server 2017.
@moderators plz mark this question as closed, thank you.
回答2:
The missing \ was caused by a bug from Sql Server. See this question for details: CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file. And download the update here: https://www.microsoft.com/en-us/download/confirmation.aspx?id=56128.
来源:https://stackoverflow.com/questions/57884772/create-file-encountered-operating-system-error-5access-is-denied-while-attemp