asp.net-core-2.0

Unable to create migrations after upgrading to ASP.NET Core 2.0

心不动则不痛 提交于 2019-12-17 06:29:00
问题 After upgrading to ASP.NET Core 2.0, I can't seem to create migrations anymore. I'm getting "An error occurred while calling method 'BuildWebHost' on class 'Program'. Continuing without the application service provider. Error: One or more errors occurred. (Cannot open database "..." requested by the login. The login failed. Login failed for user '...'" and "Unable to create an object of type 'MyContext'. Add an implementation of 'IDesignTimeDbContextFactory' to the project, or see https://go

ASPNET Core OIDC Correlation Failed

有些话、适合烂在心里 提交于 2019-12-14 04:07:39
问题 I have looked at a bunch of similar issues on StackOverflow similar to this but none of the solutions have worked for me. This issue is driving me nuts! The main difference I have from many of the similar ones here is that I have only ONE server behind the load balancer, so the issue is not that my requests are going to different servers. I have implemented Data Protection middleware, changed my callback path, tried to capture error events, added a cache for state data, etc. Nothing has

Ember 3.2.2 not routing request to .NET Core 2.1 JSON web API

不打扰是莪最后的温柔 提交于 2019-12-14 03:34:02
问题 I am new to using Ember and have been following an online video tutorial (see weblink below, though its dated as it uses .NET Core 1.0) that demonstrates how to setup a JSON API back-end with an Ember front-end - I am using Visual Studio Code. I have successfully completed the first video and receive responses from the JSON API back-end. However, I am unable to get the second video working by having Ember send a request to the api-back end for data retrieval. I know this because I am

ASP.net MVC Core 2 Entity Framework returns null

柔情痞子 提交于 2019-12-14 03:29:18
问题 I´m creating an ASP.net Core 2 Application. There is an existing MS-SQL Database which I want to use in the Project. I have added the Database with the following command: dotnet ef dbcontext scaffold "Server=XXXX;Database=XXXX;Trusted_Connection=True;IntegratedSecurity=False;User Id=XXXX;Password=XXXX" Microsoft.EntityFrameworkCore.SqlServer --output-dir Models/DB In the Database there is the following Connection: Persons ----- PersonsGroupRelationships ----- Groups In the Entity Framework

PO file localization not working as expected for data annotation

断了今生、忘了曾经 提交于 2019-12-14 02:19:03
问题 I have used Orchard Localization in my asp.net core application. Startup.cs services.AddPortableObjectLocalization(options => options.ResourcesPath = "Resources"); services .AddMvc() .AddViewLocalization(LanguageViewLocationExpanderFormat.Suffix) .AddDataAnnotationsLocalization(); model.cs [Display(Name = "First Name")] [Required(ErrorMessage = "Customer first name required")] public string CustomerFirstName { get; set; } en.po (contains English translations) msgid "Customer first name

DbContext class in .Net Core

99封情书 提交于 2019-12-13 20:19:56
问题 Hi Guys I am trying to migrate from Asp.Net MVC 5 to .Net Core 2.0 Web Application. I am stuck with a error saying : Cannot convert from 'string' to 'Microsoft.EntityFrameworkCore.DbContextOptions' I get the above error when I hover over the class: public class ExampleModelWrapper : DbContext { public ExampleModelWrapper() : base("name=EXAMPLE_MODEL") { } } ExampleModelWrapper is a model. I referred to the following question in stack overflow: How can I implement DbContext Connection String

ASP.NET Core Razor Page multiple path routing

别来无恙 提交于 2019-12-13 13:04:47
问题 I'm building a system using ASP.NET Core 2.0 Razor Pages (not MVC) and I'm having trouble adding multiple routes for pages. For example, all pages should be able to be reached by abc.com/language/ segment /shop/mypage or abc.com/language/shop/mypage, where both paths point to the same page. The segment path section is optional, then the pages do stuff with the optional segment info. The question mark syntax in the CombineTemplates markup doesn't seem to work, it seems to only work in the last

Bulk Read Images from URL using TPL (Task.WhenAll) goes into deadlock when WebClient gives timeout exception

こ雲淡風輕ζ 提交于 2019-12-13 12:45:16
问题 I created a .net core 2.0 console application where I am reading image data from URLs and process them. As images are in bulk, i am doing in threads. Everything works fine but when images does not return any data and throws timeout exception, threads get stuck/hang and does continue. It seems some deadlock but i don't know where exactly. Below is my code. int batchSize = 25; int numberOfBatches = xmlProperties.Count() < batchSize ? 1 : ((((xmlProperties.Count() / batchSize) % 1) == 0) ?

How to add font awesome to a .net core 2 spa with angular 4 project

大城市里の小女人 提交于 2019-12-13 09:01:40
问题 I found this but I don't have an angular cli file so I tried to install with npm and then add it with import statement in my wwwroot/css/style.css file but that didn't work either. EDIT: My project is an Angular 4 App With Asp.Net Core 2.0 Web API so the suggested tutorial was unable to resolve the issue. 回答1: How to add font awesome to ASP.NET Core Angular 2 application in Visual Studio 2017 with SpaTemplates I reread the article and found that I missed something. I resolved the issue. 来源:

ASP.NET Core MVC app fails to publish after changing target framework

隐身守侯 提交于 2019-12-13 08:20:11
问题 I have an MVC Core application where the target framework was .NET Core 2.0 . It built, ran, and published perfectly. Then I installed the Core SDK 2.1 and upgraded the target framework to .NET Core 2.1 . Now the app still builds fine, but when I try and publish it, I get the following error: Assets file 'C:\Projects\QuickDrive\Code\QuickDrive.Mvc\obj\project.assets.json' doesn't have a target for '.NETCoreApp,Version=v2.0'. Ensure that restore has run and that you have included 'netcoreapp2