asp.net-core-mvc

How do I get a serilog enricher to work with dependency injection while keeping it on startup?

拥有回忆 提交于 2021-02-07 06:12:34
问题 There is an answer here: How do I pass a dependency to a Serilog Enricher? which explains you can pass an instance in. However to do that I would need to move my logger setup after my dependency injection code has ran (in the startup.cs ) This means that startup errors won't be logged because the logger won't be ready yet. Is there a way to somehow configure serilog to run in my Main() method, but also enrich data with a DI item? The DI item has further dependencies (mainly on database

How do I get a serilog enricher to work with dependency injection while keeping it on startup?

筅森魡賤 提交于 2021-02-07 06:11:58
问题 There is an answer here: How do I pass a dependency to a Serilog Enricher? which explains you can pass an instance in. However to do that I would need to move my logger setup after my dependency injection code has ran (in the startup.cs ) This means that startup errors won't be logged because the logger won't be ready yet. Is there a way to somehow configure serilog to run in my Main() method, but also enrich data with a DI item? The DI item has further dependencies (mainly on database

How do I get a serilog enricher to work with dependency injection while keeping it on startup?

余生颓废 提交于 2021-02-07 06:10:52
问题 There is an answer here: How do I pass a dependency to a Serilog Enricher? which explains you can pass an instance in. However to do that I would need to move my logger setup after my dependency injection code has ran (in the startup.cs ) This means that startup errors won't be logged because the logger won't be ready yet. Is there a way to somehow configure serilog to run in my Main() method, but also enrich data with a DI item? The DI item has further dependencies (mainly on database

How do I get a serilog enricher to work with dependency injection while keeping it on startup?

孤街醉人 提交于 2021-02-07 06:09:21
问题 There is an answer here: How do I pass a dependency to a Serilog Enricher? which explains you can pass an instance in. However to do that I would need to move my logger setup after my dependency injection code has ran (in the startup.cs ) This means that startup errors won't be logged because the logger won't be ready yet. Is there a way to somehow configure serilog to run in my Main() method, but also enrich data with a DI item? The DI item has further dependencies (mainly on database

How do I get a serilog enricher to work with dependency injection while keeping it on startup?

左心房为你撑大大i 提交于 2021-02-07 06:09:17
问题 There is an answer here: How do I pass a dependency to a Serilog Enricher? which explains you can pass an instance in. However to do that I would need to move my logger setup after my dependency injection code has ran (in the startup.cs ) This means that startup errors won't be logged because the logger won't be ready yet. Is there a way to somehow configure serilog to run in my Main() method, but also enrich data with a DI item? The DI item has further dependencies (mainly on database

Shared wwwroot files in different projects

本秂侑毒 提交于 2021-02-07 04:00:55
问题 In the "older" ASP.NET MVC projects you were able to create two separate MVC projects. Use the first project as the "main" MVC project and let that project then reference the second project (with some additional config settings). Basically how 3rd party MVC projects were setup. You reference their assemblies in your own MVC project and you auto-magically have "Admin" pages available as well. I'm currently trying to find out if this is possible for the newer MVC ASP.NET 5 as well. I basically

The oauth state was missing or invalid. An error was encountered while handling the remote login

筅森魡賤 提交于 2021-02-06 14:17:53
问题 I am facing issues while implementing external login in asp.net core 2.2 (mvc) without using identity. After signing in to google it redirect back to callback url that is throwing exception as attached in the image below. Exception: The oauth state was missing or invalid. Unknown location Exception: An error was encountered while handling the remote login. Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler.HandleRequestAsync() For more detailed steps that I did, please check here

The oauth state was missing or invalid. An error was encountered while handling the remote login

南楼画角 提交于 2021-02-06 14:07:07
问题 I am facing issues while implementing external login in asp.net core 2.2 (mvc) without using identity. After signing in to google it redirect back to callback url that is throwing exception as attached in the image below. Exception: The oauth state was missing or invalid. Unknown location Exception: An error was encountered while handling the remote login. Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler.HandleRequestAsync() For more detailed steps that I did, please check here

The oauth state was missing or invalid. An error was encountered while handling the remote login

旧城冷巷雨未停 提交于 2021-02-06 14:06:40
问题 I am facing issues while implementing external login in asp.net core 2.2 (mvc) without using identity. After signing in to google it redirect back to callback url that is throwing exception as attached in the image below. Exception: The oauth state was missing or invalid. Unknown location Exception: An error was encountered while handling the remote login. Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler.HandleRequestAsync() For more detailed steps that I did, please check here

IFormFile always null (ASP.NET Core with MVC/Razor)

送分小仙女□ 提交于 2021-02-06 07:47:26
问题 I have an ASP.NET Core MVC app attempting to upload an IFormFile. However, the IFormFile is always null. None of the other solutions I've found have solved this issue. What am I doing wrong? Model public class EmailForm { [Display(Name = "Add a picture")] [DataType(DataType.Upload)] [FileExtensions(Extensions = "jpg,png,gif,jpeg,bmp,svg")] public IFormFile SubmitterPicture { get; set; } } Controller public async Task<ActionResult> Contribute([Bind("SubmitterPicture")] EmailForm model) { if