asp.net-core-2.0

How to configure ASP.NET Core to handle circular references without breaking the body's response?

感情迁移 提交于 2019-12-10 17:13:37
问题 I have this ASP.NET Core 2.0 MVC Controller: [Route("api/[controller]")] public class SampleDataController : Controller { [HttpGet("[action]")] public Example Demo() { return new Example("test"); } public class Example { public Example(string name) { Name = name; } public string Name { get; } public IEnumerable<Example> Demos { get { yield return this; } } } } When querying /api/SampleData/Demo , I get as response body: {"name":"test","demos":[ ...which is obviously very broken JSON-like

Profiling asp.net core 2 (web api) with angular 5

一曲冷凌霜 提交于 2019-12-10 17:12:41
问题 I am looking for Profiling solutions for following environment, could someone suggest please. ASP.NET Core 2 on net471 EntityFramework 6.2.0 Angular 5.0.0 I looked into MiniProfiler & Glimpse . Glimpse has not been upgraded for Core 2.0 yet. MiniProfiler works with Core 2 but does not work properly for SPA. Someone has tried to extend http of Angular 2 but Angular 5 now uses HttpClient & interceptor I think. Also I could not figure out how to profile DataContext (System.Data.Linq) for SQL

Share same _layout.cshtml within different projects of one solution with ASP.NET Core 2.0 MVC

家住魔仙堡 提交于 2019-12-10 16:19:40
问题 We are developing multiple intranet websites with different functionalities. We plan to have a root project (with some basic functionality) from which the user can navigate to the different other projects. We plan that all projects of this kind should use the same Layout _Layout.cshtml . To accomplish this we tried to link the _Layout.cshtml from the "side-projects" to the root project. We used the VS buildin link method as described here: https://stackoverflow.com/a/19862471/9641435 The file

JSON parsing in c# item is not an array

北城以北 提交于 2019-12-10 16:05:50
问题 I am trying to parse a JSON string, that looks like that: { "totalCreditsRemoved": 1, "invalidReceivers": [], "ids": [100070531], "validReceivers": ["+33635938286"] } I retrieve this from a web API, and stock it as a String: var reader = new StreamReader(respStream); String result = reader.ReadToEnd().Trim(); response = result; Response is a public string Then, in another method: I try to parse my json string: var json = response; var objects = JArray.Parse(json); foreach (JObject root in

How to define custom web.config in .Net Core 2 for IIS publish?

余生长醉 提交于 2019-12-10 15:48:38
问题 VS will generate (and override) a web.config file as part of publishing to IIS. I have various items I need to include in the file (like extending the file upload max size limit, redirecting to HTTPS, etc.). I am currently having to copy and paste the contents into the file after every publish. Is there a way to define the contents of the web.config file that Visual Studio generates when publishing a .NET Core 2 web app for IIS? 回答1: not sure if you solved this, but if anyone else runs across

Visual Studio 2017 v15.5 Aspnet Core 2.0.3 fails to debug on IISExpress

有些话、适合烂在心里 提交于 2019-12-10 15:18:47
问题 After I recently updated my visual studio 2017 installation from 15.4.5 to 15.5 I have lost the ability to hit breakpoints in my aspnet core 2.0 applications. The configuration is in debug any cpu. While this works fine on kestrel (Debugging as a consoile app), on IISExpress it does not hit my breakpoints. As a sidenote the weird thing here is it seems to have the debug symbols loaded on runtime (the breakpoint is correctly highlighted) and no warning. Environment: Runtime Environment: OS

WCFclient operation only Async .Net core 2.0

♀尐吖头ヾ 提交于 2019-12-10 14:35:11
问题 I added wcf services end point in asp.net core 2.0 to connected services and then I try to use that but with client there is only functions which ended with ..async I don't want to use ...async.But there is no function without .async What is problem with this?What should I do? instead of using that var response = SystemClient.SearchCountriesAsync(.... I want to use that var response = SystemClient.SearchCountries(... but it give that error Error CS1061 'SystemClient' does not contain a

Storing Azure Vault Client ID and Client Secret

主宰稳场 提交于 2019-12-10 13:36:51
问题 I am using .NET Core 2.0 and ASP.NET Core 2.0 for application development. The "test" application is a .NET Core Console application. The core code I am writing is a class library. Once proper testing. I choose to do this since I won't be putting this to use for awhile (it's replacing older ASPNET code). Anyway, since I have to work with a LOT of API keys for various services I decided to use Microsoft Azure Key Vault for storing the keys. I have this all setup and understand how this works.

How to update Bootstrap v3.3.7 to v4.0.0 beta2 in Asp.net core 2.0 mvc project?

浪尽此生 提交于 2019-12-10 13:09:58
问题 I am wondering what is the process to update Bootstrap v3.3.7 to v.4.0.0 beta-2 in Asp.net core 2.0 mvc project. 回答1: follow steps for bootstrap 4.0.0 beta.3 version. Most probably for other versions also will work. Open Node.js Console Cd Path to your project where package.json is located run command npm install popper.js --save run command npm install bootstrap@4.0.0-beta.3 webpack --config webpack.config.vendor.js - update vendor.js and vendor.css files. rebuild project and test it. If it

ASP NET Core 2.0 appsettings.Development.json not working with logging configuration

有些话、适合烂在心里 提交于 2019-12-10 13:02:07
问题 I have installed VS2017 15.3.0 Preview 4 and .NET Core 2.0 Preview 2 and have created a default Web MVC application. I am interested in seeing how the new logging functionality works but I cannot get VS to use the logging values defined in appsettings.Development.json when viewing the Debug output window. My understanding is that the appsettings.Development.json file takes precedence over the appsettings.json yet only values in the latter file has any effect on the debug window. Is this right