CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file

淺唱寂寞╮ 提交于 2020-01-16 13:46:55

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!