简体   繁体   English

无法从网络上的PC访问WPF应用程序中的数据库(.mdf文件)

[英]Can't access the DataBase (.mdf file) in my WPF application from PC's on network

I created a wpf application which connect to some sql database tables. 我创建了一个wpf应用程序,该应用程序连接到一些sql数据库表。 When i run this application on my pc every thing works fine,but when i try to run it from other pc on the local network i got an error: "The file ("file name") is on a network path that is not supported for database files". 当我在PC上运行此应用程序时,一切正常,但是当我尝试从本地网络上的其他PC运行它时,出现错误:“文件(“文件名”)位于不支持的网络路径上用于数据库文件”。

What is the best way to create a WPF application that have to run from some pc's on the local network that share a common DB? 创建WPF应用程序的最佳方法是什么,该应用程序必须从共享公共DB的本地计算机上的某些PC运行?

Have you considered a database server, SQL Server, MySQL, or something similar? 您是否考虑过数据库服务器,SQL Server,MySQL或类似的产品? If you really want to stick to a file based database (something I wouldn't recommend for security reasons) then you can use something like SQLite. 如果您真的想坚持基于文件的数据库(出于安全考虑,我不建议您这样做),则可以使用类似SQLite的方法。

You will only be able to connect to your server (your pc in this case) instance from another pc if you have 'named pipes' enabled. 如果启用了“命名管道”,则只能从另一台PC连接到服务器实例(在本例中为PC)。 You can also enable TCP\\IP etc. if needs be, but this is probably why you are getting the error. 如果需要,您还可以启用TCP \\ IP等,但这可能就是您收到错误的原因。

Named Pipes is not available in the Compact or Free versions of MSSQL. 命名管道在MSSQL的精简版或免费版中不可用。

A database server or pc with a proper version of MSSQL is your best bet. 最好的选择是带有正确版本的MSSQL的数据库服务器或PC。

yepppp solved. yepppp解决了。 Thanks for your answers. 感谢您的回答。 I did some things that finally solved my problem: 1. Remove the "uid=Tomer, pwd=, and pooling=False" from the connection string. 我做了一些事情终于解决了我的问题:1.从连接字符串中删除“ uid = Tomer,pwd =和pooling = False”。 2. Enable Port 1433(sql port) in the firewall. 2.在防火墙中启用端口1433(sql端口)。 3. Enable the TCP/IP and the 'named pipes' as i mentioned before. 3.如前所述,启用TCP / IP和“命名管道”。

Thanks alot for your help. 非常感谢你的帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM