Pet*_*ron 7 mobile detection asp.net-mvc-3 asp.net-mvc-4 51degrees
添加51Degrees移动检测库后,我的ASP.NET MVC 3项目变慢了.所限定的51Degrees日志文件<log logFile="~/bin/App_Data/51Log.txt" logLevel="Info" />
中<fiftyOne>
部分表明,装置库重新加载对于每个请求,增加了对每个请求一个2-3秒的延迟:
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
Run Code Online (Sandbox Code Playgroud)
此外,<fiftyOne>
<log ... logLevel="Debug">
web.config中的设置会在启动时引发以下异常:
Storage scopes cannot be created when _AppStart is executing.
Run Code Online (Sandbox Code Playgroud)
如果我创建一个空白的ASP.NET MVC 4应用程序并添加最新的51Degrees 2.0.3.2 NuGet包,一切都很完美.正如预期的那样,日志反映出二进制数据尽管多次请求只被加载一次(51Degrees.mobi-Lite-2012.01.05.dat).
非常乐观,我将所有主要的MVC 3项目代码复制到一个新的ASP.NET MVC 4项目并重新添加了最新的51Degrees包,但问题再次出现.必须与我的某个软件包不兼容,或者是一个奇怪的设置.
日志显示正在为每个请求重新加载库:
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'.
Run Code Online (Sandbox Code Playgroud)
延迟远小于XML数据文件(300ms vs 3000ms),但它仍然会导致明显的延迟.
两个项目的51Degrees.mobi.config文件是相同的,在我的web.config中,这是我加载的模块:
<modules>
<remove name="Detector"/>
<add name="Detector" type="FiftyOne.Foundation.Mobile.Detection.DetectorModule, FiftyOne.Foundation"/>
</modules>
Run Code Online (Sandbox Code Playgroud)
什么可能导致51Degrees库重新加载每个请求?
发生这种情况是因为日志文件放在bin文件夹中.只要bin文件夹中发生任何更改,工作进程就会重新启动.将日志文件移动到〜/ App_Data文件夹,您将发现问题将得到解决.感谢您使用51Degrees.mobi.
归档时间: |
|
查看次数: |
1233 次 |
最近记录: |