.net-core

How can I get Azure AD Authentication from .Net Core program for Angular app

こ雲淡風輕ζ 提交于 2021-02-08 10:40:38
问题 I have a .Net Core 3.1 program that hosts an Angular 10 application. The Angular application has a login page where the user can enter a username and password which gets sent to a login function in .Net Core which returns an oAuth token that is used in all calls to the api from Angular. The token only gets returned once the username and password are checked against a database. I would like to have a "Sign in with Microsoft" button on the login form that the user could click instead of

ASP.NET Core 3.1 WebRoot Path

二次信任 提交于 2021-02-08 10:38:50
问题 I am pushing an external file into the wwwroot folder of my ASP.NET Core 3.1 application. I need to reference the path to provide a constructor variable during the services wire up. In the Startup class I have added the IWebHostEnvironment to the constructor parameters: public Startup(IConfiguration configuration, IWebHostEnvironment env) { Configuration = configuration; _env = env; } When debugging, it seems that _env.WebRootPath returns the path as it is in my source folder, rather than the

How to use Dapper to automatically map remaining columns to dictionary?

馋奶兔 提交于 2021-02-08 10:30:51
问题 I am attempting to use Dapper to map to my DTO: public class MyDto { public int Id { get; set; } public string Code { get; set; } public IDictionary<string, object> AdditionalColumns { get; set; } } I can have an instance of MyDto populate the first two properties based on convention, but I'm not sure how to tell Dapper to map all remaining columns into the dictionary. connection.Query<MyDto>("Get_Something", commandType: CommandType.StoredProcedure, param: parameters); The stored procedure

Protobuf-net has missing dependency System.Private.ServiceModel

こ雲淡風輕ζ 提交于 2021-02-08 10:00:12
问题 We have a project that uses protobuf-net for serialising and deserialising our protobuf messages. It builds fine on windows, but on our Linux build environment we seem to end up missing a dependency. When the dotnet core 2.1 service runs up we get an error of: An assembly specified in the application dependencies manifest (xxxx.deps.json) was not found: package: 'System.Private.ServiceModel', version: '4.5.3' path: 'runtimes/unix/lib/netstandard2.0/System.Private.ServiceModel.dll' undefined

Protobuf-net has missing dependency System.Private.ServiceModel

淺唱寂寞╮ 提交于 2021-02-08 10:00:09
问题 We have a project that uses protobuf-net for serialising and deserialising our protobuf messages. It builds fine on windows, but on our Linux build environment we seem to end up missing a dependency. When the dotnet core 2.1 service runs up we get an error of: An assembly specified in the application dependencies manifest (xxxx.deps.json) was not found: package: 'System.Private.ServiceModel', version: '4.5.3' path: 'runtimes/unix/lib/netstandard2.0/System.Private.ServiceModel.dll' undefined

SqlException: Invalid column name 'Discriminator'. Invalid column name 'Discriminator'. Invalid column name 'Discriminator'

余生颓废 提交于 2021-02-08 10:00:08
问题 In ASP Dotnet Core While login/Register getting error SqlException: Invalid column name 'Discriminator'. Invalid column name 'Discriminator'. Invalid column name 'Discriminator'. Its showing error on Areas.Identity.Pages.Account.LoginModel.OnPostAsync(string returnUrl) in Login.cshtml.cs var result = await _signInManager.PasswordSignInAsync(Input.Email, Input.Password, Input.RememberMe, lockoutOnFailure: false); if i use [NotMapped] public class ApplicationUser : IdentityUser{ } then it solve

.net core HTTPS requests returns 502 bad gateway while Postman returns 200 OK

自作多情 提交于 2021-02-08 09:31:32
问题 What's wrong with this code snippet in C#.NET core 3: using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Net.Http; using System.Threading.Tasks; namespace ConsoleApp1 { class Program { static async Task Main(string[] args) { var uriBuilder = new UriBuilder { Scheme = Uri.UriSchemeHttps, Host = "api.omniexplorer.info", Path = "v1/transaction/address", }; var req = new Dictionary<string, string> { { "addr", "1FoWyxwPXuj4C6abqwhjDWdz6D4PZgYRjA" } }; using(var

Debian: No authentication handler is configured to handle the scheme: Automatic

拜拜、爱过 提交于 2021-02-08 09:25:12
问题 I have some issue like this, but i can't understand how to solve it for Debian. At first, i configure my application as described below app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationScheme =MyAuthSchemeName, CookieName = MyCookiName, AutomaticAuthenticate = true, AutomaticChallenge = false, SlidingExpiration = true, ExpireTimeSpan = TimeSpan.FromDays(1), DataProtectionProvider = DataProtectionProvider.Create(MyApplicationName) }); app.UseJwtBearerAuthentication

VSCode Asp.Net core command line arguments when debugging?

只愿长相守 提交于 2021-02-08 09:15:34
问题 Just been reading this article from Scott Allen. The approach to specify command line arguments to .net core seems intersing, but how do we pass those arguments from VS Code when running with debugger (Normally using F5 command if launch.json is setup)? e.g dotnet run dropdb migratedb seeddb 回答1: Copying over answer from comment In your launch.json , try adding: "args": ["dropdb", "migratedb", "seeddb"] to the target launch configuration. 来源: https://stackoverflow.com/questions/41189755

VSCode Asp.Net core command line arguments when debugging?

拈花ヽ惹草 提交于 2021-02-08 09:09:11
问题 Just been reading this article from Scott Allen. The approach to specify command line arguments to .net core seems intersing, but how do we pass those arguments from VS Code when running with debugger (Normally using F5 command if launch.json is setup)? e.g dotnet run dropdb migratedb seeddb 回答1: Copying over answer from comment In your launch.json , try adding: "args": ["dropdb", "migratedb", "seeddb"] to the target launch configuration. 来源: https://stackoverflow.com/questions/41189755