Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
76 views
in Technique[技术] by (71.8m points)

c# - Where does ELMAH save its data?

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!

question from:https://stackoverflow.com/questions/9343517/where-does-elmah-save-its-data

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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>

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>

Here you can find example web.config file.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...