Questions tagged [asp.net-core]

ASP.NET Core is a lean, composable and cross-platform framework for building web and cloud applications. It is fully open source on GitHub. ASP.NET Core apps can be run on Windows with the full .NET Framework or smaller .NET Core, or on Linux and MacOS with .NET Core and Mono.

1
vote
0answers
18 views

ASP.NET Core 2.2 Integration Testing DbContext Service not registered

Setup Windows 10 Visual Studio Professional 2017 v15.9.9 ASP.NET Core 2.2 EF Core 2.2 Dapper xUnit 2.4.1 Description I'm using the WebApplicationFactory from the Microsoft.AspNetCore.Mvc.Testing ...
0
votes
0answers
23 views

How to keep DbContext in Connected state with Web API

Since Web APIs are stateless when you have EF Core backend after any request the DbContext would be disconnected. Therefore we have made QueryTracking as NoTracking since default behavior TrackAll ...
0
votes
1answer
15 views

Suppress validation errors in ASP.NET Core's automatic 400 response

Although the automatic 400 response is useful, I don't want to send validation errors to the client. This is the response body: { "errors": { "username": [ "'username' must not be empty."...
1
vote
0answers
21 views

How to receive body attachment with application-json content type and boundary?

Our API should replace someone else API without many changes because of clients, but previous API receiving data in some form which i cannot replicate in .net core. In this case ModelState isn't valid ...
1
vote
1answer
27 views

Seed test data for every test in ASP.NET Core / EF Core / xUnit.NET integration tests

I've been following the strategies for setting up tests for an ASP.NET Core 2.2 API using the Microsoft documentation at Integration tests in ASP.NET Core. To summarize, we extend and customize ...
3
votes
2answers
28 views

How to pass data from viewmodel to entities?

I am new to MVC and trying to understand viewmodels. I have Staff, Service, BookingSlot, Appointments and the ApplicationUser entities. I have the following viewmodel: public class ...
0
votes
0answers
9 views

ASP.NET Core: global handling for showing exception message in current page

In my application I have a set of errors that are "expected" and thus they shouldn't redirect the user to a full error page when they occur. For example, I would like to show the error message in a ...
1
vote
0answers
8 views

How to retrieve IIS log parameter value [Parameter name: Bytes Sent (sc-bytes ) & Bytes Received (cs-bytes)] from HttpContext object

I want to write access log for my application similar to IIS access log (e.g IIS log file Path: "C:\inetpub\logs\LogFiles\W3SVC1\u_ex190422.log") using .net core. For below fields I am able to ...
0
votes
0answers
28 views

HttpContext Header

I have created this class for getting the Header value from requests. public class AuthenticationHeader { private static IHttpContextAccessor _httpContextAccessor; public ...
0
votes
0answers
11 views

Net core site hosted in IIS need a Debug before it is running

I'm trying to host a net core website on IIS on localhost, but when navigating to the site I only get the services not available.. After choosing "debug->start new instance" in Visual Studio, the ...
-1
votes
0answers
21 views

Need recommandations for pattern implementation to inject “processors” into a NuGet from WebApp

We are currently developping an internal NuGet package that will send a HTTP Request to another microservice. Here's a sample of the implementation I am looking for. [NuGet package] has a middleware,...
0
votes
0answers
11 views

unable to add application insights to service fabric stateless asp.net core project

I'm trying to add application insights to a project with the following guide. https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-tutorial-monitoring-aspnet my project is a service ...
0
votes
0answers
13 views

How to receive IHubContext out of Dependency Injected classes?

I want to send message from Service A using SignalR when some event occures (for example, message from Service B received). So hub method needs to be called from some sort of handler, that not ...
0
votes
1answer
26 views

How do I populate text fields with information from Active Directory?

I would like to populate some read only text fields with information from Active Directory, for example name and email address for the user who is currently logged on. I am using .NET Core 2.2 and ...
2
votes
0answers
24 views

Getting the HubContext of a SignalR hub

I am trying to get the hubcontext from a SignalR hub. I want to be able to send notifications to the clients connected to that hub, while the hub instance may be disposed of. The caveat is that I ...
0
votes
0answers
7 views

Can .net core's signalr hub have a transaction scope?

Normally with API, you can set a transaction scope on dbcontext, is it gonna be an issue if I will try to set a transaction scope inside of the SignalR hub event handler? I couldn't find information ...
0
votes
0answers
9 views

Can I use custom ad-hoc attribute names with ODataQueryOptions?

Context I would like to implement a standard OData service on my entity using ASP.NET Core 2.2 The entity persisted in custom hybrid store not in RDBMS, so I concluded to implement my own query ...
-1
votes
0answers
22 views

External login fails asp.net mvc core 2.2

Did scaffold some identity pages (Login, Logout, Register) for translation purposes and added Google as an external provider. It works, but when I hit Register on the Identity/Account/ExternalLogin ...
0
votes
0answers
15 views

Selenium is not running while using docker

1.Create a project in VS 2.Create a docker file have (java, npm, nightwatch) everything configured 3.In powershell, navigate to ../../Blogplayground.E2ETest 4.Type npm run test:chrome 5.Click on ...
0
votes
0answers
11 views

Azure CI / CD for ASP.NET Core Web API on Azure Web App has error: No package found with specified pattern: D:\a\r1\a\**\*.zip

I'm using donet build in my azure-pipelines.yml now to build my project and create my artifact: # ASP.NET Core # Build and test ASP.NET Core projects targeting .NET Core. # Add steps that run tests, ...
0
votes
1answer
14 views

Reference related resources in API Post method

I am creating an API's endpoint that creates a post: POST > /posts Each post can have up to one Category and multiple Tags. When creating a post I need to reference its Category and Tags if any: ...
2
votes
0answers
63 views

Is there a way to specify a Class by having its Type?

There is one problem. OracleDataReader can report the column name, type, and value by type. int i = № of column string name = reader.GetName(i) Type fieldType = reader.GetFieldType(i) reader....
1
vote
0answers
17 views

Setup of azure-pipelines.yml “No web project was found in the repository” with ASP.NET Core

I need help to setup my azure-pipelines.yml build file because I cannot find any good tutorial, sample or other kind of help anywhere. I follow this tutorial by Microsoft https://docs.microsoft.com/...
0
votes
1answer
29 views

How to inspect asp.net core methods?

I created a new ASP.NET Core MVC application with individual user accounts authentication. I would like to see how they implemented some methods. I suppose I can do it since ASP.NET Core is open ...
0
votes
2answers
32 views

Inject request scoped object at run time asp.net core

I have a middleware in the ASP.NET Core pipeline where im injecting an object at runtime like this public async Task Invoke(HttpContext context) { _container.Inject(someObject); await ...
0
votes
0answers
6 views

PerformanceCounter used in Code on windows will work on Linux based server using Docker?

I haven't work with Docker. So, my Question is very basic. If I develop a dotnet core Application in Windows OS which is using PerformanceCounter. Can I deploy this to Linux Based Server? Will ...
0
votes
0answers
4 views

lifecycle in asp net core signalR java client

how to identify when java client connected successfully to SignalR. where is onConnect life cycle . i want to do something when hubConnection connected to server. hubConnection have onClose method ...
0
votes
0answers
13 views

What is the recommended way to connect a WebApp to a local Server in .Net Core?

I am trying to build an architecture supporting the following scenario: a remote server (ASP.NET Core) provides access to multiple remote Databases. A SinglePageApplication is served from this server ...
0
votes
1answer
12 views

Asp.Net Core - Prevent Session cookie conflict between same domain applications

I'm using ASP.Net Core 2.2. By default, session cookie is stored in a cookie named .AspNetCore.Session on a specific domain (e.g: mydomain.com). In my case I have multiple .net core applications ...
0
votes
2answers
22 views

CS1525 Invalid expression term '>' in razor view page ASP.NET-core 2.2

I have the following code in the razor page view of my ASP.NET-Core 2.2 MVC application <p> @{ if(course.Description.Length > 100) { @course.Description.Substring(0, ...
1
vote
0answers
23 views

How do I use data-* attributes with Html.DropdownListFor helper?

I'm trying to create a dropdown list (using bootstrap-select) with different data-subtext attributes on each option. The thing is, when I use tag helper, it automatically creates validation tags (...
1
vote
0answers
13 views

Auth0 + Swashbuckle .Net Core 2.2. Missing claims in jwt token when using SwaggerUI

I am making a ASP.Net Core WebApi which is authentication via Auth0. I am using Swagger and SwaggerUI and trying to authenticate from Swagger UI. // Add authentication services services....
0
votes
0answers
16 views

How to test IProfileService custom claims in a API using postman?

I have a Api service, which uses Custom claims, that has been added in the IProfileService IdentitySever4. How can I populate those custom claims whilst sending the request from postman? What I ...
0
votes
1answer
24 views

Managing DbContext lifetime in ASP.NET Core SignalR

I have implemented an ASP.Core SignalR Application. A shared hub class is invoking a signal to all its client on every 10 seconds from class SharedHub (this class is not inherited from Hub it has ...
1
vote
0answers
18 views

How to retrieve IIS log parameter value [Parameter name: Service Name and Instance Number (s-sitename)] from HttpContext object

I want to write access log for my application similar to IIS access log (e.g IIS log file Path: "C:\inetpub\logs\LogFiles\W3SVC1\u_ex190422.log") using .net core. For below fields I am able to ...
0
votes
0answers
13 views

How to integrate Social Login with existing .Net core Web API backend and Angular SPA frontend with working OpenIddict user/password and bearer token

TL;DR Question: how to implement social login (OAuth2 authorization flow) with an existing SPA/Web API application that is based on identity, user/password, bearer token authentication? I have an ...
0
votes
2answers
29 views

Where is Application Insights injecting HttpContext into IHttpContextAccessor.Request?

I've found myself in an interesting position. I currently use the latest Unity container, I'm on asp.net core 2.2, and I use application insights. As such, I have configured DI in my web app to use ...
0
votes
1answer
26 views

How to pass an object to controller that contains an html string in .NetCore

I have an object that I want to pass to the controller. This object contains multiple strings that contains different sections of html code. My code worked for normal strings being passed, but once I ...
0
votes
1answer
22 views

Get and Set Data CheckboxList on Table in Asp Core 2.2

I wrote a class and set public IActionResult Index(): public class SuperBowl { public string Name { get; set; } public double Price { get; set; } public bool ...
-2
votes
0answers
21 views

SignalR sample with .net core 2.2 [on hold]

I'm looking for a SignalR hub / client sample for .net core 2.2 because every test I have put together has a crash., Something simple like creating a hub and having a client call a method, purely in ...
0
votes
2answers
35 views

This site can’t provide a secure connection asp.net core from dotnet linux

I am currently developing an API using asp.net core 2.1. When I use the ide visual studio 2019 in windows I don't have problems running the project, but now I am using manjaro linux and I compile by ...
0
votes
0answers
28 views

ASP.Net Identity with MVC 5 Web API 2 and and Net Core Api

This might have been asked/answered before, so apologies if that is the case - I simply can't get it working. I have a very old ASP.NET MVC application with a large number of Web API 2 controllers in ...
0
votes
2answers
50 views

Persistent in-memory concurrent dictionary in ASP.NET Core

In an ASP.NET Core application, I would like to have persistent, shared state that is analogous to: ConcurrentDictionary<string, Job> Jobs; Various components of the applications will access ...
0
votes
1answer
39 views

C#, ASP.Net Core and Linq: dealing with null dates

I am having trouble craft a multi join query in Visual Studio 2019, C#, ASP.Net core. I have two tables: sessions( id int primary key, start_id int not null, // foreign key to "...
0
votes
0answers
18 views

How to configure adfs with OAuth2 using .net core?

I am configuring authentication in my app using OAuth until now I have configured all endpoint what I supposed to need, but the external server, where AD FS is configured, keep showing an error. I ...
0
votes
1answer
23 views

Preserving data even when ModelState is invalid or one required entry is null

Whenever I submit form to the Edit action method on my controller, without any entry or with invalid entry, it triggers the error message as expected. However, I lose all the other data as well. I am ...
0
votes
0answers
14 views

Why is traceid sent in automatic 400 responses in ASP.NET Core 2.2

ASP.NET Core 2.2 sends automatic 400 responses for actions which fail model binding and validation. The result looks like: { "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1", "title": ...
1
vote
0answers
43 views

Unable to call CreatedAtAction more than once

I've created a .NET Core API Controller, and in the POST method, I'm trying to use the CreatedAtActionResult method to include the route as a Location Header in my response. [ApiController, Route("v1/...
0
votes
1answer
20 views

NPOI On importing excel - returning the UI inside UI instead of the table in UI

I need to create a view in ASP.NET Core which takes excel as input in the form of file upload and displays a table of the contents of the excel file in the UI. I followed this blog to try and use ...
0
votes
0answers
23 views

Bootstrap Modal Popups and Collapsible lists fail to appear in production

This is a strange one... I've got collapsible controls like such: <button class="btn btn-primary" data-toggle="collapse" data-target="#meals">Meals</button> <div id="meals" class="...

http://mssss.yulina-kosm.ru