سؤال

The following line in 51Degrees.mobi.config adds 2-3 seconds of loading time to each of my ASP.NET MVC 4 project's controller actions:

<fiftyOne>
    <log logFile="~/bin/App_Data/51Log.txt" logLevel="Info" />
    ...
</fiftyOne

The same thing happens for ASP.NET MVC 3. If I remove the <log> section, pages load almost instantly. I'm using the binary device database for detection like so:

<detection binaryFilePath="~/App_Data/51Degrees.mobi-Lite-2012.01.05.dat" />

Setting the logLevel to Debug causes the following exception:

`Storage scopes cannot be created when _AppStart is executing.`

Why does this cause such a drastic slowdown? Is it a symptom of a deeper problem?

Could there be an incompatibility with StructureMap for dependency injection?


Update: Thanks to @James Rosewell, I figured out why the logging slowed down my application. It's related to the logFile path. Everytime 51Degrees writes to the 51Log.txt file in the ~/bin directory, it causes IIS to recycle the pool and reload all the modules. Changing the log path to ~/App_Data solved the problem.

لا يوجد حل صحيح

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top