ELMAH将数据保存在哪里? [英] Where does ELMAH save its data?
问题描述
我刚刚安装了ELMAH.MVC(更多信息此处),并且想知道其数据在哪里已保存。我读到您可以选择设置数据库进行存储,但是默认安装似乎使用内存中?它是如何工作的?如果我回收应用程序池或IIS网站,是否会丢失所有数据?谢谢!
I just installed ELMAH.MVC (more info here) and was wondering where its data is saved. I read that you can choose to set up database for storage but seems that the default install uses "in memory"? How does it work? If I recycle the app pool or IIS website do I loose all the data? Thanks!
推荐答案
是的,默认情况下,它使用内存存储。重新启动应用程序池后,您将丢失elmah数据。如果我还记得,旧版本的Elmah使用App_Data文件夹来存储xml文件...如果要使用数据库存储日志,只需在elmah config部分中指定连接字符串:
Yes, by default it uses memory storage. When your application pool is restarted, you loose elmah data. If I remember well, old versions of elmah used App_Data folder for storing xml files...If you want to use database to store logs, just specify connection string in your elmah config section:
<elmah>
...
<errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="ElmahConnectionString"/>
...
</elmah>
您应该在connectionStrings部分中包含ElmahConnectionString,如下所示:
You should have ElmahConnectionString in your connectionStrings section, something like this:
<connectionStrings>
<add name="ElmahConnectionString "
connectionString="Initial Catalog=my_database;data source=.\SQLEXPRESS;Integrated Security=SSPI;"
providerName="System.Data.SqlClient" />
...
</connectionStrings>
在这里,您可以找到示例web.config文件。
Here you can find example web.config file.
这篇关于ELMAH将数据保存在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!