小编ash*_*lon的帖子

Serilog的AddSerilog无法识别

我正在尝试调用loggerFactory.AddSerilog(); 根据文档,但无法识别AddSerilog方法:

"错误CS1061'ILoggerFactory'不包含'AddSerilog'的定义,也没有扩展方法'AddSerilog'接受第一个......".

我正在使用ASP.NET CORE和完整的.NET框架.我究竟做错了什么?

.net c# serilog asp.net-core

16
推荐指数
4
解决办法
1万
查看次数

What are a security token and security stamp in ASP.NET Identity?

I need background about two features of ASP.NET Identity please:

  1. Security token - What is it? is it a temporary password sent to the user's email?
  2. Security Stamp - Is it something else than security tokens? If yes, what's its purpose? how are they different?

Thanks, ashilon

asp.net-identity

14
推荐指数
1
解决办法
1万
查看次数

在ASP.NET Core应用程序中启用Windows身份验证和匿名身份验证

我知道之前已经多次询问过这个问题,但遗憾的是,不是关于ASP.NET核心网络应用程序,而是经典的ASP.NET网络应用程序.我在互联网上找到的所有答案都没有帮助我,因为ASP.NET核心应用程序的IIS配置与传统的ASP.NET有很大不同.例如,ASP.NET Core使用Kestrel代理,因此ASP.NET中的许多配置都不在ASP.NET Core中.我基本上已经尝试过我可能在互联网上找到的所有内容,但没有人帮助过我.我想它就像在IIS中的应用程序上启用匿名和Windows身份验证一样简单,就是这样,但我想它会比这更有用.

在单个asp.net核心Web应用程序中启用这些身份验证的过程是什么?

c# authentication iis-8 kestrel-http-server asp.net-core

14
推荐指数
3
解决办法
1万
查看次数

控制台在哪里登录由IIS托管的asp.net核心应用程序

我使用优秀的Serilog库将日志记录添加到asp.net核心应用程序中.我为Sql Server和Literate控制台添加了接收器.
sql server sink当然是完美的,但是,这有点令人尴尬,我不知道如何在控制台窗口中显示日志.
这是我尝试过的:

  1. 在已发布的目录中,我运行了命令dotnet run但是收到错误,指出project.json不存在.当然,如果我在该文件所在的dev机器上运行命令,这当然有效.日志显示在打开的控制台上.
  2. 我也尝试直接运行exe,它说它正在侦听:http:// localhost:5000,但是在控制台窗口中没有显示日志记录.

这是代码:

public Startup(IHostingEnvironment env)
    {
        var builder = new ConfigurationBuilder()
            .SetBasePath(env.ContentRootPath)
            .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
            .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
            .AddEnvironmentVariables();
        Configuration = builder.Build();

        ConfigureLogging();
    }

    private void ConfigureLogging()
    {
        Log.Logger = new LoggerConfiguration()
            .MinimumLevel.Verbose()
            .WriteTo.LiterateConsole(LogEventLevel.Verbose)
            .WriteTo.RollingFile(".\\Logs\\log-{Date}.txt")
            .WriteTo.MSSqlServer(Configuration.GetConnectionString("Logging"), "Logs"/*, columnOptions: new ColumnOptions()*/)
            .CreateLogger();
    }

    public IConfigurationRoot Configuration { get; }

    public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IApplicationLifetime appLifetime)
    {
        app.Use(async …
Run Code Online (Sandbox Code Playgroud)

logging serilog asp.net-core

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

用于在状态之间切换或循环的设计模式

是否存在设计模式(如访问者,策略,状态等)或其他一些设计原则,以帮助设计一个良好的解决方案来模拟实体的状态流,例如任务实体.

任务以状态启动,然后进入BeingHandled状态,然后进入WaitingForApproval,然后它可以移动到FinishedNotApproved,这实际上是回到了 带有其他信息的BeingHandled,说它是从WaitingForApproval返回的.

所以一般来说我们有一些一般的流程,然后我们可以在其中有一些内部流程.

谢谢,

ashilon

architecture design-patterns

4
推荐指数
1
解决办法
158
查看次数

INodeServices 已过时:使用 Microsoft.AspNetCore.SpaServices.Extensions

我们最近从 ASP.NET Core 1.0 升级到 3.1。
在我们的代码中,我们使用接口 INodeServices 并调用其 InvokeAsync 方法来激活一些 JavaScript 库。升级到 Core 3.1 后,编译器抱怨 INodeServices 已过时,应替换为“Microsoft.AspNetCore.SpaServices.Extensions”,但我在该库中找不到任何可以用来代替 INodeServices 的类型,而且我也找不到任何有关它的文档。ASP.NET Core 3.1 中 INodeServices.InvokeAsync 的替代品是什么?

谢谢,
阿希隆

asp-net-core-spa-services asp.net-core-3.1

3
推荐指数
1
解决办法
3167
查看次数

从ASP.NET CORE Web应用程序中的appsettings.json加载Hangfire配置

我正在尝试将Hangfire与SQL Server配合使用,从appsettings.json文件中读取连接字符串。没用 仅当我将连接字符串提供给UseSqlServerStorage方法时,它才起作用。

这是appsettings.json

{
  "ConnectionStrings": {
    "HangfireDemo": "Data Source=VSQL64;Initial Catalog=HangfireDemo;Integrated Security=SSPI;"
  },
  "Logging": {
    "IncludeScopes": false,
    "LogLevel": {
      "Default": "Debug",
      "System": "Information",
      "Microsoft": "Information"
    }
  }
}  
Run Code Online (Sandbox Code Playgroud)

这是在Startup.ConfigureServices中配置Hangfire的行:

services.AddHangfire(configuration => configuration.UseSqlServerStorage("Data Source=VSQL64;Initial Catalog=HangfireDemo;Integrated Security=SSPI;"));  
Run Code Online (Sandbox Code Playgroud)

如果我在UseSqlServerStorage方法中编写“ HangfireDemo” ,则无法使用。此方法中只有完整的连接字符串有效。
如何仅提供连接字符串名称?

c# connection-string hangfire asp.net-core

2
推荐指数
1
解决办法
1560
查看次数