小编Chr*_*rda的帖子

使用Nlog并将文件写为json

我想我错过了一些东西,因为我似乎无法弄清楚如何使用配置文件中的NLog设置以json格式写入日志文件.直接滚动文件工作正常,但不是json.json目标仅输出消息(不在json中).

<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">        
    <targets async="true">
      <target xsi:type="File" name="rollingFile" fileName="${basedir}/logs/${shortdate}.log" archiveFileName="${basedir}/logs/{shortdate}_Archive{###}.log" archiveAboveSize="1000000" archiveNumbering="Sequence" layout="${longdate} ${uppercase:${level}} ${callsite} ${message}" />
      <target xsi:type="File" 
              name="rollingFileJson" 
              fileName="${basedir}/logs/${shortdate}.json" 
              archiveFileName="${basedir}/logs/{shortdate}_Archive{###}.json" 
              archiveAboveSize="1000000" 
              archiveNumbering="Sequence" 
              layout="${json-encode} ${message}">
      </target>

    </targets>
    <rules>
      <logger name="*" minlevel="Trace" writeTo="rollingFile" />
      <logger name="*" minlevel="Trace" writeTo="rollingFileJson" />
    </rules>
  </nlog>
Run Code Online (Sandbox Code Playgroud)

json nlog

7
推荐指数
2
解决办法
7142
查看次数

IdentityServer4 和 Azure AD - 输入凭据后将空白页 404 设置为 login.live

我正在尝试在开发环境中将 Azure AD 设置为 IdentityServer4 的外部提供程序。谷歌和 Facebook 提供商已经成功连接。我被定向到 login.microsoft.com 上的登录页面,在那里我输入我的登录 ID 并选择一个 MS 帐户,然后它会将我定向到 login.live.com 作为一个空白页面 (404) 而不是重定向回我的 IdentityServer实例。

我尝试了很多东西,但没有运气。

是否需要在 Azure 中启用企业应用程序?

我错过了什么吗?

身份服务器 URL: http://localhost:5000

身份服务器 URL: http://localhost:47740

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

...
app.UseOpenIdConnectAuthentication(CreateAzureAdOptions(clientId, tenantId));
...

 public static OpenIdConnectOptions CreateAzureAdOptions(string clientId, string tenentId)
    {
        return new OpenIdConnectOptions
        {
            DisplayName = "Azure Active Directory",
            AuthenticationScheme = "Azure",
            ClientId = clientId,
            Authority = string.Format(CultureInfo.InvariantCulture, "https://login.microsoftonline.com/{0}", tenentId),
            ResponseType = "id_token",
            Scope = { "openid" },
            SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme,
            AutomaticChallenge = true,
            AutomaticAuthenticate = true,
            RequireHttpsMetadata …
Run Code Online (Sandbox Code Playgroud)

azure-active-directory openid-connect identityserver4

5
推荐指数
1
解决办法
950
查看次数