哪里的SQL Server Compact文件? [英] Where is the SQL Server Compact file?

查看:220
本文介绍了哪里的SQL Server Compact文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用SQL Server Compact数据库的ASP.NET MVC项目。我有我的 FoobarContext 下面的连接字符串:

I have an ASP.NET MVC project that uses a SQL Server Compact database. I have the following connection string for my FoobarContext:

<add name="FoobarContext"
 connectionString="Data Source=|DataDirectory|Foobar.sdf"
 providerName="System.Data.SqlServerCe.4.0"/>



我启动了该项目,并出现如预期持续存在的数据。但是,我无法找到一个名为Foobar.sdf任何地方的文件。我在想什么。

I fired up the project and it appears to persist data as expected. However, I can't find a file named 'Foobar.sdf' anywhere. What am I missing?

更新:
这不是把我的连接字符串。设置断点和检查的背景下,我找到了它的ConnectionString竟是以下内容:

Update: It wasn't taking my connection string. Setting a breakpoint and inspecting the context, I found its ConnectionString was actually the following:

Data Source=.\\SQLEXPRESS;Initial Catalog=MvcApplication3.Infrastructure.Data.FoobarContext;Integrated Security=True;MultipleActiveResultSets=True

之谜解决了。​​

推荐答案

这绝对应该是〜/ App_Data文件默认情况下,但你可以尝试运行的AppDomain。 CurrentDomain.GetData(DataDirectory目录)来看到ASP.Net认为该目录存在。

It definitely should be ~/App_Data by default, but you can try running AppDomain.CurrentDomain.GetData("DataDirectory") to see where ASP.Net thinks the directory exists.

如果这揭示了什么兴趣,你可能想确保你的Windows资源管理器设置为显示隐藏文件,以防万一这就是为什么你看不到文件

If this reveals nothing of interest, you may want to make sure your windows explorer is set to show hidden files, just in case that's why you don't see the file.

这篇关于哪里的SQL Server Compact文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆