ASP.NET MVC 2 嵌入式数据库
我正在构建一个非常小的临时网站,需要一个小型后备存储。我已经在 ASP.NET MVC 2 中构建了它,并希望使用 DiscountASP 进行托管 - 尽管这不是必需的。
我想要一个后备存储,它可以与 ASP.NET MVC 2、VS2010 Express 一起使用,启用 LINQ(或 EF),并且可以在共享主机上运行而无需进一步付费。
根据我的调查,SQLCE 3.5 在 .NET 4 中不起作用 SQLCE 4,只是CTP,在VS2010中不起作用 SQlite 没有任何 .NET 4.0 驱动程序。
我做对了吗?有什么好的教程或博客可以展示如何逐步实现此操作吗?
谢谢, 标记
I am building a very small temprorary website that needs a small backing store. I have built this in ASP.NET MVC 2, and wanted to host with DiscountASP - although this isn't essential.
I would like an backing store that will work with ASP.NET MVC 2, VS2010 Express, enabled LINQ (or EF) and work without further charges on a shared host.
From my investigation, SQLCE 3.5 doesn't work in .NET 4
SQLCE 4, is only CTP and doesn't work in VS2010
SQlite doesn't have any .NET 4.0 drivers.
HAve I got this right? Any good tutorials or blogs that show how to get this working step by step?
Thanks,
Mark
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
SQLite 可以在 .Net 4.0 上运行。以下是有关 .NET 中嵌入式数据库的其他一些非常类似的问题:
SQLite does work on .Net 4.0. Here are some other very similar questions about embedded databases in .NET:
我不是 ASP 专家,但您听说过 Firebird SQL 吗?具有客户端/服务器或嵌入式版本的数据库引擎,具有事务等功能,并具有 ADO.NET 提供程序
http:// firebirdsql.org/dotnetfirebird/
http://firebirdsql.org/ index.php?op=devel&sub=netprovider
I'm not an ASP expert but have you heard about Firebird SQL? Database engine which has client/server or embeded versions, fully featured with transactions etc. and with ADO.NET provider
http://firebirdsql.org/dotnetfirebird/
http://firebirdsql.org/index.php?op=devel&sub=netprovider
不,甚至不要考虑使用嵌入在 ASP.NET 中的 firebird。
这是严格禁止的。
Firbird 网站上的一个参考资料告诉您要避免:
Is it possible to use theEmbedded Firebird in my ASP.NET application?
是的。但 Firebird ADO.NET 在应用程序工作目录中查找 fbembed.dll 文件。对于 ASP.NET 应用程序,工作目录是系统文件夹(例如 C:\WINDOWS\System32)。但这并非没有问题
链接文本
在同一网站的另一个页面上:
ASP .NET 使用一项功能来帮助防止编写不当的 ASP.NET 应用程序阻塞整个服务器 - 它会定期回收 ASP.NET 工作进程。默认情况下,IIS6 使用重叠回收,即在旧进程停止之前启动新进程,以确保不间断运行。问题是 fbembed.dll 独占锁定所有者进程的数据库,因此如果您同时运行另一个进程,则在第一个进程停止之前数据库将无法访问。您可能想接受这一点,但这确实不是最佳解决方案。
解决方案是关闭重叠回收(通过将 DisallowOverlappingRotation 配置数据库属性设置为 true)。但是,这可能会导致应用程序在回收期间中断。
结论
不要这样做;-)。事实上,fbembed.dll **并不是为了处理此类使用而构建的。你可以让它工作,但这只是一个黑客。
No, Dont even think about using firebird embedded in ASP.NET.
It is strictly forbidden.
here's a reference on Firbird website tell you to avoid:
Is it possible to use the embedded Firebird in my ASP.NET application?
Yes. But Firebird ADO.NET looks for the fbembed.dll file in the application working directory. For ASP.NET application the working directory is the system folder (e.g. C:\WINDOWS\System32). But it's not without problems
link text
On Another page from the same website:
ASP.NET uses a feature that help against poorly written ASP.NET application to block the entire server - it recycles the ASP.NET working process both regularly. By default, IIS6 uses overlapped recycling where there is a new process started before the old is stopped to ensure uninterrupted operation. The problem is that the fbembed.dll exclusively locks the database for the owner process so if you run another process simultaneously the database won't be accessible before the first process stops. You might want to accept this but it really is not an optimal solution.
The solution is to turn off the overlapped recycle (by setting the DisallowOverlappingRotation metabase property to true). However, this might cause outages of your application during recycle.
Conclusion
Don't do tha**t ;-). Really, fbembed.dll **was not built to handle such use. You can make it work but it is just a hack.