asp.net-core-2.0

Development Server hot updates not working

扶醉桌前 提交于 2019-12-18 05:48:27
问题 I upgraded my .NET Core 2.1 project to Angular 6 and everything seems to be working correctly except for hot-updates. Before updating it was possible to update the TypeScript and VS would re-compile and reload the browser, now that seems to be broken along with having to manually run ng build to recompile the scripts, VS doesn't seem to recompile automatically anymore. Is there a setting, possibly in angular.json that I need to set to enable the development server? Update For some reason, Hot

Error: The method or operation is not implemented. while scaffolding MYSQL Database

一世执手 提交于 2019-12-18 05:43:20
问题 I'm using .net core 2.0. I have installed the following nuget Packages: 1: Microsoft.AspNetCore.All 2: Microsoft.EntityFrameworkCore.Tools 3: MySql.Data.EntityFrameworkCore 4: MySql.Data.EntityFrameworkCore.Design When I try to scaffold the database using the following command in the package manager console Scaffold-DbContext "server=localhost;port=3306;user=root;password=mypass;database=SampleDB" MySql.Data.EntityFrameworkCore -OutputDir SampleEFMySQL -f I get the following Error. System

ASP.Net Core 2.0 mixed authentication of JWT and Windows Authentication doesn't accept credentials

好久不见. 提交于 2019-12-17 22:18:16
问题 I've API created in asp.net core 2.0 where I am using mixed mode authentication. For some controllers JWT and for some using windows authentication. I've no problem with the controllers which authorize with JWT. But for the controllers where I want to use windows authentication I am indefinitely prompted with user name and password dialog of chrome. Here my sample controller code where I want to use Windows Authentication instead of JWT. [Route("api/[controller]")] [Authorize

How to use HTTPS / SSL with Kestrel in ASP.NET Core 2.x?

左心房为你撑大大i 提交于 2019-12-17 21:48:51
问题 I am currently using ASP.NET Core 2.x and I used to be able to get Kestrel to to use HTTPS / SSL by simply putting it in the UseUrls() method like so: var host = new WebHostBuilder() .UseUrls("http://localhost", "https://111.111.111.111") .UseKestrel() .Build(); But now I get the exception: System.InvalidOperationException: HTTPS endpoints can only be configured using KestrelServerOptions.Listen(). How do I configure Kestrel to use SSL in ASP.NET Core 2.x? 回答1: The basics. Using Server URLs

The provider for the source IQueryable doesn't implement IAsyncQueryProvider

六月ゝ 毕业季﹏ 提交于 2019-12-17 20:47:05
问题 I have some codes like below, I want to write unit tests my method. But I'm stuck in async methods. Can you help me please ? public class Panel { public int Id { get; set; } [Required] public double Latitude { get; set; } public double Longitude { get; set; } [Required] public string Serial { get; set; } public string Brand { get; set; } } public class CrossSolarDbContext : DbContext { public CrossSolarDbContext() { } public CrossSolarDbContext(DbContextOptions<CrossSolarDbContext> options) :

Use a Inline Table-Valued Functions with Linq and Entity Framework Core

孤街浪徒 提交于 2019-12-17 20:36:53
问题 I created an Inline Table-Valued Functions (ITVF) in SQL Server that returns a table of values (query simplified for discussion purposes): CREATE FUNCTION dbo.VehicleRepairStatus() RETURNS TABLE AS RETURN SELECT VehicleID, CurrentStatus FROM VehicleRepairHistory ... Which I can reference in a query: SELECT v.ID, v.Name, r.CurrentStatus FROM Vehicle v LEFT OUTER JOIN dbo.VehicleRepairStatus() r on v.ID = r.VehicleID I'd like to be able to use it in Linq query: var vehicles = await

Setting JsonConvert.DefaultSettings asp net core 2.0 not working as expected

一曲冷凌霜 提交于 2019-12-17 19:45:30
问题 I have following code inside Startup.cs and expecting it to override default serialization options. I want it to override every single serialization throughout my asp net core 2.0 project, but action return value that is not correct, I think this global property is not working in core 2.0 I have it written inside Configure exactly before app.UseMvc(); JsonConvert.DefaultSettings = () => new JsonSerializerSettings { Formatting = Formatting.Indented, TypeNameHandling = TypeNameHandling.Objects,

Configure ASP.NET Core 2.0 Kestrel for HTTPS

我的梦境 提交于 2019-12-17 17:57:08
问题 TL;DR What is today the correct way to setup HTTPS with ASP.NET Core 2.0? I would like to configure my project to use https and a certificate like they have shown at BUILD 2017. I have tried several settings but nothing worked. After some research, I am even more confused. It seems that there are many ways to configure URLs and ports… I have seen appsettings.json , hosting.json , via code, and in launchsettings.json we can also set the URL and port. Is there a "standard" way to do it? Here is

How to integrate Ninject into ASP.NET Core 2.0 Web applications?

[亡魂溺海] 提交于 2019-12-17 09:48:06
问题 I have found out that Ninject has recently introduced support for .NET Standard 2.0 / .NET Core 2.0. However, I cannot find any extension to actually integrate it in the Web application (e.g similar to Ninject.Web.Common) Looking on the code from an old ASP.NET MVC solution, I realized that the whole mechanism is different as the classic one relied on WebActivatorEx.PreApplicationStartMethod and WebActivatorEx.ApplicationShutdownMethodAttribute which are no longer available in ASP.NET Core.

Identity in ASP.Net Core 2.1 : Customize AccountController

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-17 07:13:05
问题 I have installed ASP.NET Core 2.1 but even though I have created a new ASP.NET Core Web Application using ASP.NET Core 2.1 with Individual User Accounts → Store user accounts in-app I can't find the AccountController or Views. I can still register and login without a problem but I can't find the code for it, it were present in 2.0. 回答1: One of the changes in 2.1 was Razor Class Libraries and the default identity lives in one of these in the individual auth templates. If you would like to have