.net-core

Asp.net Core Applications Issue with Razor and MVC Pages

瘦欲@ 提交于 2021-02-10 23:36:32
问题 I have reinstalled my VS 2019 and cloned my applications on my machine. But suddenly all the applications stopped showing add -> Controller --> MVC 5 Controller and its View. After rebuild my application is converted into Razor from MVC Core 3.1. and now all applications throws error of g.cshtml.cs file. Help me to fix this issues. Why my .net core MVC application is converted to Razor. Why application not adding MVC controller and view. 回答1: Create an empty ASP.NET Core MVC project Change

How to use oAuth State parameter on MSAL.NET

こ雲淡風輕ζ 提交于 2021-02-10 22:20:40
问题 I am trying to make usage of the state parameter which exists in OAuth2.0 authorization flow on a .NET Core project, using MSAL 4.0 but I couldn`t find a way to do it. I want to provide/append a custom value (Redirect the user back to the Uri where they clicked the sign-in button, after AuthN succeeds). To do that, I would also need to send the current Uri in 'state' and retrieve the state value back, but I don't see any method/property on AuthenticationResult.cs that would hold it. So, how

How to use oAuth State parameter on MSAL.NET

旧时模样 提交于 2021-02-10 22:10:26
问题 I am trying to make usage of the state parameter which exists in OAuth2.0 authorization flow on a .NET Core project, using MSAL 4.0 but I couldn`t find a way to do it. I want to provide/append a custom value (Redirect the user back to the Uri where they clicked the sign-in button, after AuthN succeeds). To do that, I would also need to send the current Uri in 'state' and retrieve the state value back, but I don't see any method/property on AuthenticationResult.cs that would hold it. So, how

Combine Azure-AD with local user database in dotnet core 2 web-api

断了今生、忘了曾经 提交于 2021-02-10 18:51:49
问题 I am creating a .net-core2 web-api, which allows users from an Azure-AD to consume it. The API is multi-tenant, so users from multiple Azure-AD's should be able to authorize. However, it is also possible to create an account for users who do not have a corporate Azure-AD account. These users are stored in a database (local users). Because it is a web-api, I implemented a custom token provider, so that the local users can get a token to consume the protected web-api. However, I cannot add two

Combine Azure-AD with local user database in dotnet core 2 web-api

旧街凉风 提交于 2021-02-10 18:51:41
问题 I am creating a .net-core2 web-api, which allows users from an Azure-AD to consume it. The API is multi-tenant, so users from multiple Azure-AD's should be able to authorize. However, it is also possible to create an account for users who do not have a corporate Azure-AD account. These users are stored in a database (local users). Because it is a web-api, I implemented a custom token provider, so that the local users can get a token to consume the protected web-api. However, I cannot add two

Combine Azure-AD with local user database in dotnet core 2 web-api

假如想象 提交于 2021-02-10 18:49:41
问题 I am creating a .net-core2 web-api, which allows users from an Azure-AD to consume it. The API is multi-tenant, so users from multiple Azure-AD's should be able to authorize. However, it is also possible to create an account for users who do not have a corporate Azure-AD account. These users are stored in a database (local users). Because it is a web-api, I implemented a custom token provider, so that the local users can get a token to consume the protected web-api. However, I cannot add two

Axios Post request returns 204 No Content Status. What do I need to change to get a 201/persist the data?

試著忘記壹切 提交于 2021-02-10 18:04:51
问题 When locally attempting to make a POST request with Axios on my NodeJS front-end app to my .NET core local server, the server returns a 204 and the axios request returns a pending promise. What do I need to change to achieve a 201 created status/persist the record? When I try a post request in Postman it works perfectly, but my app however, behaves differently. axios request: export const postStudent = (firstName: string, lastName: string, yearLevel: string) => { return axios .post( `$

How to catch configuration binding exception?

允我心安 提交于 2021-02-10 17:50:52
问题 I am building a console application in .NET Core 2.2. I added strongly-typed configuration like this: var configuration = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", true) .AddCommandLine(args) .Build(); services.Configure<AppConfiguration>(configuration); My configuration is bound to an object of class AppConfiguration . I wonder, how can I catch exceptions that could happen while binding config values to my class? For example,

Accessing .net Core API via azure VM throws ERR_CONNECTION_REFUSED

不羁岁月 提交于 2021-02-10 14:40:43
问题 I've set up a linux VM using Azure and I have the public IP from that machine. I've cloned my repo inside that machine and I run dotnet run and I get the output: Hosting environment: Development Content root path: /home/g67Admin/projeto_integrador_grupo67/mdv Now listening on: https://localhost:5001 Now listening on: http://localhost:5000 Application started. Press Ctrl+C to shut down. Then I try to go to: https://(public IP):5001/api/Drivers and I cannot access it, gives me this error ERR

Dot net Core – How to fix: TimeOut-Error to MSSQL 2017 (which does not happen with .Net 4.7.1)

笑着哭i 提交于 2021-02-10 14:18:23
问题 Can't connect to a MS SQL Server 2017 Express from dotnet core 2.2 console application. Checked Server Configuration as in Connection to SQL Server Works Sometimes I have installed a new Microsoft SQL Server 2017 Express. Then tested the connection to this server with a console application (under .Net Framework 4.7.1). Works!. Then I created a console application under Dot Net Core 2.2. Installed NuGet package System.Data.SqlClient and tried connect to the sql server using the same connection