51Degrees重装对每个请求减缓ASP.NET MVC到爬行 [英] 51Degrees reloading on each request slows ASP.NET MVC to a crawl

查看:206
本文介绍了51Degrees重装对每个请求减缓ASP.NET MVC到爬行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的ASP.NET MVC 3项目添加51Degrees移动检测库后慢如蜗牛。该51Degrees日志由定义文件<登录日志=〜/斌/的App_Data / 51Log.txtLOGLEVEL =信息/> < fiftyOne> 部分揭示了设备库重新加载为每个请求添加为每个请求2-3秒延时:

My ASP.NET MVC 3 project slows to a crawl after adding the 51Degrees mobile detection library. The 51Degrees log file defined by <log logFile="~/bin/App_Data/51Log.txt" logLevel="Info" /> in the <fiftyOne> section reveals that the device library is reloaded for each request, adding a 2-3 seconds delay for each request:

2011-10-22T14:17:34.9863774Z - 8436 - Info - Loaded 14691 devices using 11640 strings in 1882ms
2011-10-22T14:17:50.8442844Z - 8436 - Info - Loaded 14691 devices using 11640 strings in 1820ms
2011-10-22T14:17:57.2756523Z - 8436 - Info - Loaded 14691 devices using 11640 strings in 1928ms
2011-10-22T14:18:01.0488681Z - 8436 - Info - Loaded 14691 devices using 11640 strings in 1886ms
2011-10-22T14:18:04.6790757Z - 8436 - Info - Loaded 14691 devices using 11640 strings in 1862ms

此外,设置&LT; fiftyOne&GT; &LT;日志... LOGLEVEL =调试&GT; 中web.config中抛出以下异常的启动:

Furthermore, setting <fiftyOne> <log ... logLevel="Debug"> in web.config throws the following exception on start:

Storage scopes cannot be created when _AppStart is executing.


MVC 4更新

一切完美,如果我创建一个空白ASP.NET MVC 4应用程序并添加最新的2.0.3.2 51Degrees包的NuGet。正如预期的那样,日志反映了二进制数据,因为只有被尽管多次请求加载一次(51Degrees.mobi-精简版 - 2012.01.05.dat)。


MVC 4 Update

Everything works perfectly if I create a blank ASP.NET MVC 4 application and add the latest 51Degrees 2.0.3.2 NuGet package. As expected, the log reflects that the binary data as only being loaded once despite multiple requests (51Degrees.mobi-Lite-2012.01.05.dat).

仔细看好,我复制了所有我的主要MVC 3项目code到一个新的ASP.NET MVC 4项目,并重新添加了最新51Degrees包,但问题再次出现。必须与我的包之一,或怪异的设置不兼容。

Carefully optimistic, I copied all my main MVC 3 project code over to a new ASP.NET MVC 4 project and re-added the latest 51Degrees package, but the problem recurs. Must be an incompatibility with one of my packages, or a weird setting.

日志显示该库被重新加载为每个请求:

The log shows that the library is being reloaded for each request:

2012-01-18T11:50:02.5026920Z - 11928 - Info - Creating provider from binary data file '~\App_Data\51Degrees.mobi-Lite-2012.01.05.dat'.
2012-01-18T11:50:02.8137098Z - 11928 - Info - Created provider from binary data file '~\App_Data\51Degrees.mobi-Lite-2012.01.05.dat'.
2012-01-18T11:50:07.7419917Z - 11928 - Info - Creating provider from binary data file '~\App_Data\51Degrees.mobi-Lite-2012.01.05.dat'.
2012-01-18T11:50:08.0170074Z - 11928 - Info - Created provider from binary data file '~\App_Data\51Degrees.mobi-Lite-2012.01.05.dat'.
2012-01-18T11:50:10.4191448Z - 11928 - Info - Creating provider from binary data file '~\App_Data\51Degrees.mobi-Lite-2012.01.05.dat'.
2012-01-18T11:50:10.7251623Z - 11928 - Info - Created provider from binary data file '~\App_Data\51Degrees.mobi-Lite-2012.01.05.dat'.

延迟比XML数据文件(300毫秒VS 3000ms)要少得多,但它仍然造成明显的延迟。

The delay is much less than the XML data file (300ms vs 3000ms), but it's still causing a noticeable delay.

这两个项目的51Degrees.mobi.config文件是相同的,在我的web.config,这是我加载模块:

The two projects' 51Degrees.mobi.config files are identical and in my web.config, this is the module I have loaded:

<modules>
    <remove name="Detector"/>
    <add name="Detector" type="FiftyOne.Foundation.Mobile.Detection.DetectorModule, FiftyOne.Foundation"/>
</modules>

这可能是导致该51Degrees库重新加载在每次请求?

What could be causing the 51Degrees library to reload on each request?

推荐答案

这是发生,因为日志文件被放置在bin文件夹。一旦有事情在bin文件夹改变工作进程将重新启动。日志文件移动到〜/ App_Data文件夹,你会发现这个问题将得到解决。感谢您使用 51Degrees.mobi

This is happening because the log file is placed in the bin folder. Whenever anything changes in the bin folder the worker process will restart. Move the log file to the ~/App_Data folder and you'll find the problem will be resolved. Thank you for using 51Degrees.mobi.

这篇关于51Degrees重装对每个请求减缓ASP.NET MVC到爬行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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