我正在尝试调用loggerFactory.AddSerilog(); 根据此文档,但无法识别AddSerilog方法:
"错误CS1061'ILoggerFactory'不包含'AddSerilog'的定义,也没有扩展方法'AddSerilog'接受第一个......".
我正在使用ASP.NET CORE和完整的.NET框架.我究竟做错了什么?
I need background about two features of ASP.NET Identity please:
Thanks, ashilon
我知道之前已经多次询问过这个问题,但遗憾的是,不是关于ASP.NET核心网络应用程序,而是经典的ASP.NET网络应用程序.我在互联网上找到的所有答案都没有帮助我,因为ASP.NET核心应用程序的IIS配置与传统的ASP.NET有很大不同.例如,ASP.NET Core使用Kestrel代理,因此ASP.NET中的许多配置都不在ASP.NET Core中.我基本上已经尝试过我可能在互联网上找到的所有内容,但没有人帮助过我.我想它就像在IIS中的应用程序上启用匿名和Windows身份验证一样简单,就是这样,但我想它会比这更有用.
在单个asp.net核心Web应用程序中启用这些身份验证的过程是什么?
我使用优秀的Serilog库将日志记录添加到asp.net核心应用程序中.我为Sql Server和Literate控制台添加了接收器.
sql server sink当然是完美的,但是,这有点令人尴尬,我不知道如何在控制台窗口中显示日志.
这是我尝试过的:
这是代码:
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) 是否存在设计模式(如访问者,策略,状态等)或其他一些设计原则,以帮助设计一个良好的解决方案来模拟实体的状态流,例如任务实体.
任务以新状态启动,然后进入BeingHandled状态,然后进入WaitingForApproval,然后它可以移动到Finished或NotApproved,这实际上是回到了 带有其他信息的BeingHandled,说它是从WaitingForApproval返回的.
所以一般来说我们有一些一般的流程,然后我们可以在其中有一些内部流程.
谢谢,
ashilon
我们最近从 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 的替代品是什么?
谢谢,
阿希隆
我正在尝试将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” ,则无法使用。此方法中只有完整的连接字符串有效。
如何仅提供连接字符串名称?