[英]Logging session state in Application Insights for Azure Cache for Redis
I'm working on ASP.NET web application connected to Azure. Is it possible to see not only common data about connected clients and expired keys, but also more detailed logs per session (some session state info as session ID, ect.) current data in Insights for Azure Cache for Redis I'm working on ASP.NET web application connected to Azure. Is it possible to see not only common data about connected clients and expired keys, but also more detailed logs per session (some session state info as session ID, ect.) current data in Azure 的见解 Redis 的缓存
I configured session state storing in the cache as in this topic , but can't find information I needed.我按照本主题配置了 session state 存储在缓存中,但找不到我需要的信息。
Check the below steps to view the Session Info in ASP.Net
Application for Azure Cache for Redis.检查以下步骤以查看 Azure 的 Redis 的ASP.Net
应用程序中的 Session 信息。
ASP.Net
Application in Visual Studio.在 Visual Studio 中创建ASP.Net
应用程序。Hostname
from Azure Redis Cache Properties
.从 Azure Redis 缓存Properties
复制Hostname
。 Access Keys
=> Primary Key
.和来自 Redis Cache => Access Keys
=> Primary Key
的密码(访问密钥)。 My Web.config
file:我的Web.config
文件:
'<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="MySessionStateStore" type="Microsoft.Web.Redis.RedisSessionStateProvider" host="***.redis.cache.windows.net,abortConnect=false,ssl=true,allowAdmin=true,password=***"/>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.8" />
<httpRuntime targetFramework="4.8" />
<sessionState mode="Custom" customProvider="MySessionStateStore">
<providers>
<add name="MySessionStateStore" type="Microsoft.Web.Redis.RedisSessionStateProvider" host="***.redis.cache.windows.net" accessKey="***" ssl="true" />
</providers>
</sessionState>
</system.web>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" />
<bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" />
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.2.4.0" newVersion="5.2.4.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" />
</compilers>
</system.codedom>
<system.webServer>
<modules>
<remove name="Session" />
<add name="Session" type="Microsoft.AspNet.SessionState.SessionStateModuleAsync, Microsoft.AspNet.SessionState.SessionStateModule, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="integratedMode" />
</modules>
</system.webServer>
</configuration>
Application Insights
is Enabled.在您部署的应用程序中,确保启用了Application Insights
。 Application Insights
=> Sessions
.您可以在Application Insights
=> Sessions
中看到会话数。 View More Insights
tab, we will get the below data.如果您单击“ View More Insights
选项卡,我们将获得以下数据。 View session timeline
to get the session ID.单击View session timeline
以获取 session ID。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.