在我的笔记本电脑上的SQL服务器下重复LocalDB
我一直在遇到问题。
最近,当我尝试任何涉及使用SQL数据库,实体框架,Dapper等的教程时, 在SQL服务器下相同的LocalDB。此外,然后我尝试发布,数据库并未在我选择的localDB下显示。
我想知道如何去删除其他SQL服务器,而只需提供一个可用的服务器。
如果您查看下图,则浏览选项会给我两个相同的LocalDB。另外,在\ ProjectModels下,我还获得了第三个。我想知道是什么原因造成了这一点,如何将其修复,因为无论我选择哪一个,我尝试发布的SQL数据库都不会在其中任何一个中显示。
I've been running into an issue recently when I attempt any tutorials that involve using a SQL database, entity framework, dapper, etc.
When it comes time to publish a database, or utilize an ORM, I'm given duplicate options for the same localdb under SQL Servers. Furthermore, then I attempt to publish, the database doesn't show up under the localdb that I've chosen.
I'm wondering how I go about removing the other SQL Servers and just having the one available.
If you look at the image below, the Browse option gives me two of the same LocalDbs. Plus I also get a 3rd one under \ProjectModels. I'm wondering what's causing this and how it can be fixed since no matter which one I choose, the sql database I attempt to publish doesn't show up within any of them.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的建议是不要使用此方法发布数据库。 (右键单击删除)
请参阅此官方文档。
基于文件的数据库(例如SQLite或SQL Server Express)旨在将其数据存储在可与您的应用程序/站点一起使用的易于传输的文件中。
“复制到输出目录”
数据库文件的属性属于“复制新的”
。只需将地址指向它。如果您使用的是基于服务器的数据库,例如SQL Server,MySQL等,则需要确保目标机器/环境已安装了相同的数据库服务器,并且需要编写一个部署脚本来附加预处理数据文件到服务器。这对您来说可能很麻烦。
您也可以参考这些链接。 1 , 2 , 3
My advice is not to use this method to publish the database. (right click to delete)
Please refer to this official documentation.
File-based databases like SQLite or SQL Server Express are designed to store their data in easily transferable files that can be served with your application/site.
"Copy to Output Directory"
Property of the database file to"Copy if newer"
. Just point the address to it.If you are using a server-based database like SQL Server, MySQL, etc., you need to make sure that the target machine/environment has the same database server installed, and you need to write a deployment script to append the pre-populated data files to the server. This might be troublesome for you.
You can also refer to these links. 1,2,3