asp.net-core-3.0

JsonIgnore attribute keeps serializing properties in ASP.NET Core 3

让人想犯罪 __ 提交于 2020-02-13 20:37:01
问题 I've recently updated my API project to ASP.NET Core 3. Since then, [JsonIgnore] attributes are not working: public class Diagnostico { [JsonIgnore] public int TipoDiagnostico { get; set; } [JsonIgnore] public int Orden { get; set; } [JsonIgnore] public DateTime? FechaInicio { get; set; } public string TipoCodificacion { get; set; } public string Codigo { get; set; } public string Descripcion { get; set; } } All the properties of classes are being serialized. The API endpoints are in .NET

JsonIgnore attribute keeps serializing properties in ASP.NET Core 3

空扰寡人 提交于 2020-02-13 20:34:07
问题 I've recently updated my API project to ASP.NET Core 3. Since then, [JsonIgnore] attributes are not working: public class Diagnostico { [JsonIgnore] public int TipoDiagnostico { get; set; } [JsonIgnore] public int Orden { get; set; } [JsonIgnore] public DateTime? FechaInicio { get; set; } public string TipoCodificacion { get; set; } public string Codigo { get; set; } public string Descripcion { get; set; } } All the properties of classes are being serialized. The API endpoints are in .NET

I writing a shop in .Net Core 3, and I try to use Session for save Cart items, but an exception is throw [closed]

青春壹個敷衍的年華 提交于 2020-01-26 04:44:05
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 8 days ago . this is my controller and session cart . in first step i want to save cart items to session and the save to database.this programe writing by mvc core 3. i learn this code from Apress.Pro.ASP.NET.Core.MVC.6th.Edition. teacher write code to core2 but i am trying to write core3.0. public class

DI Registration service type .net core 3.0

不打扰是莪最后的温柔 提交于 2020-01-25 08:34:07
问题 I have one n-tier layered app and in Infrastructure module where I'm trying to develop sending email for confirmation an user, I'm getting an error. No service for type 'IMS.Infrastructure.Helpers.CustomEmailConfirmationTokenProvider`1[Microsoft.AspNetCore.Identity.IdentityUser]' has been registered. From code what I had did is next: public class CustomEmailConfirmationTokenProvider<TUser> : DataProtectorTokenProvider<TUser> where TUser : class { public CustomEmailConfirmationTokenProvider

Browser Link not refreshing page in Chrome

狂风中的少年 提交于 2020-01-25 06:52:27
问题 I am following this documentation to enable Browser Link and set up a new Blazor project (targeting .NET Core 3 ) using the provided template (running Visual Studio 16.3.9, which is latest as of writing). As mentioned in the documentation I have installed the nuget package Microsoft.VisualStudio.Web.BrowserLink and added the middleware to my Startup.cs public class Startup // ... public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app

Sending complex objects from signalR .NET Core 3.0 hub to clientIn

筅森魡賤 提交于 2020-01-25 00:27:30
问题 This should be a simple question. I am trying to send complex objects to a client by id from a SignalR Hub. However, I can seem to find any examples that work with .NET Core 3.0. Do I need to serialize it and call Clients.Client(id).BroadcastMessage("method",jsonString); ? or is there a better way to do this? 回答1: Note: This is tested only on ASP.NET Core 3.1 and may/may not work on older versions. You can pass multiple objects from C# and then receive them all in a Typescript function with a

Custom AuthenticationHandler not working in Asp.Net Core 3

别来无恙 提交于 2020-01-25 00:26:11
问题 I am not sure if the same happens in Asp.Net core 2.2 but this is happening when I upgraded to the latest Asp.net Core 3 version. So, my issue is that I have created a custom AuthenticationHandler like below: public class PlatformAuthenticationHandler : AuthenticationHandler<AuthenticationSchemeOptions> { public PlatformAuthenticationHandler( IOptionsMonitor<AuthenticationSchemeOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock) : base(options, logger, encoder,

asp net core 3 Getting BadRequest response on POST action with body content after publish

纵然是瞬间 提交于 2020-01-24 19:34:04
问题 I'm building a website with asp.net core 3 which I'm hosting on a Debian 9 server with nginx as a reverse proxy. I'm running against this issue that my POST requests do work when I run the application locally in visual studio, but when I publish the application and upload it to my server, they suddenly don't work anymore. This is the controller that I'm using for testing: public class TestController : Controller { [HttpPost] public IActionResult Ping() { return Ok(); } [HttpPost] public

Asp.net core 2.1 to Asp.net 3.0 upgrade

最后都变了- 提交于 2020-01-24 12:24:06
问题 I have a web api application which is working fine in 2.1. I am using same application to host in IIS on windows and without IIS on linux. Now I am trying to upgrade the application. I have upgraded the nuget packages and project version successfully.Now when trying to debug app looks there is some problem in my congiruation startup class which is as below public static void Main(string[] args) { StartupShutdownHandler.BuildWebHost(args).Build().Run(); } namespace MyApp { public class

How can I read http request body in netcore 3 more than once?

∥☆過路亽.° 提交于 2020-01-22 02:35:07
问题 I have a netcore 3 API application that logs the incoming request and then passes it on to the controller action. My code looks like this: public RequestLoggingHandler(IHttpContextAccessor httpContextAccessor) { _httpContextAccessor = httpContextAccessor; } protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, RequestLoggingRequirement requirement) { try { var httpContext = _httpContextAccessor.HttpContext; var request = httpContext.Request; _repository =