asp.net-core-2.1

Has something replaced bundleconfig.json in ASP.NET Core MVC 2.1?

冷暖自知 提交于 2020-01-23 04:15:13
问题 When I create a new ASP.NET MVC Core targeting 2.1 RC1, it doesn't create the bundleconfig.json file which is used for bundling and minification. This file is created if I target 2.0. Here is a example, the solution contains a new project targeting 2.0 and another targeting 2.1: Has something replaced the builtin bundling and minification, or is this just a bug in RC1? 回答1: bundleconfig.json was removed from the 2.1 templates because it relied on a tool not created or supported by Microsoft.

swagger.json paths and definitions are empty. No operations defined in spec

烈酒焚心 提交于 2020-01-21 18:15:22
问题 I am developing a .netcore web application. I am using of swagger and I've made all the necessary adjustments. Unfortunately it does not work and I just see No operations defined in spec! in the swagger output page. The swagger file with /swagger/v1/swagger.json has the following content: { "swagger": "2.0", "info": { "version": "v1", "title": "Something" }, "paths": {}, "definitions": {} } I want to see my controllers and their actions in swagger output page. 回答1: after some research i was

User.Identity.Name is null in Asp.Net Core 2.x web application using Windows Authentication

爷,独闯天下 提交于 2020-01-17 00:26:48
问题 Problem When hosting an Asp.Net Core 2.0 or 2.1 Web Application behind IIS with Windows Authentication set to true, and Anonymous Authentication set to false, the User.Identity.Name property is null and User.Identity.IsAuthenticated is false. According to the documentation here, Windows Authentication should just work in Asp.Net Core 2.x when hosting with IIS. Background I'm in the process of migrating an Asp.Net 4.x MVC application over to Asp.Net Core following the Migrate from ASP.NET MVC

Azure AD Auth with Angular and .NETCore2 WEBAPI

青春壹個敷衍的年華 提交于 2020-01-16 08:35:28
问题 I want to add authentication to my app using Azure AD Right now my flow is like User -> AngularApp -> Azure Login -> AngularApp w/token -> API Call to backend w/token -> API Backend verifies token with Azure each call I have following questions: Is there a better way to do this? Every API call is verified with azure. Is is required? Should i have two different client id for UI and API? 回答1: Is there a better way to do this? This is the standard way. Every API call is verified with azure. Is

Unable to resolve service for type Microsoft Extensions Configuration IConfiguration

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-16 08:24:05
问题 I am getting this error, could not understand for the life of me. Unable to resolve service for type 'Microsoft.Extensions.Configuration.IConfiguration' while attempting to activate 'Microsoft.FeatureManagement.ConfigurationFeatureSettingsProvider'. This is a simple .net core 2.2 console app, with the following nuget packages added. Microsoft.Extensions.Configuration.Json Microsoft.Extensions.DependencyInjection Microsoft.FeatureManagement using System; using System.Threading.Tasks; using

ASP.NET Core 2.1 Swagger(swashbuckle) Url template optional parameter [duplicate]

本秂侑毒 提交于 2020-01-15 12:24:29
问题 This question already has answers here : Optional WebAPI routing parameters with Swagger documentation (1 answer) Make parameters in swashbuckle optional(not required) (3 answers) Swagger: support for optional routes (1 answer) Closed 21 days ago . [HttpGet("commercial/{fromCcy}/{toCcy?}")] public ActionResult Commercial(string fromCcy, string toCcy) I have action "commercial" with optional parameter "toCcy" and swagger spec generates with required field. Is there any way to solve this

Remove “Server” header from ASP.NET Core 2.1 application

巧了我就是萌 提交于 2020-01-12 04:37:07
问题 Is it possible to remove the Server Response header in a ASP.NET Core 2.1 application (running on Server 2016 with IIS 10)? I tried putting the following in the web.config: <system.webServer> <httpProtocol> <customHeaders> <add name="X-Frame-Options" value="sameorigin" /> <add name="X-XSS-Protection" value="1; mode=block" /> <add name="X-Content-Type-Options" value="nosniff" /> <remove name="X-Powered-By" /> <remove name="Server" /> </customHeaders> </httpProtocol> </sytem.webServer> The

Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-10 17:18:28
问题 I am working on a fabric application where I have configured HTTPS. It is throwing an exception though I have a valid installed certificate. 回答1: These instructions from this blog worked for me dotnet dev-certs https --clean dotnet dev-certs https -t 回答2: I am on OSX and dotnet dev-certs https --clean and sudo dotnet dev-certs https --clean were not working for me. Finally I was able to fix it with the following steps. Go into Keychain Access Unlock System Keychain Delete the localhost

ASP.NET Core 2.1 reflection doesn't work when deploying in AWS lambda

放肆的年华 提交于 2020-01-06 07:21:12
问题 I have a library with the below code for dependency injection. This loads all implementation classes ending with Handler and register them. public static class HandlerRegistrationExtension { private static IDictionary<Type, Type> _decoratorsAttributes; public static void AddHandlers(this IServiceCollection services, IDictionary<Type, Type> decoratorsAttributes) { _decoratorsAttributes = decoratorsAttributes ?? new Dictionary<Type, Type>(); List<Type> allAssembliesTypes = Assembly

ASP.NET Core 2.1 + Log4Net

…衆ロ難τιáo~ 提交于 2020-01-04 09:02:31
问题 I'm using log4net in ASP.NET Core 2.1 project, I don't know why I'm getting log messages duplicated, here is my log4net.config configuration <?xml version="1.0" encoding="utf-8" ?> <log4net> <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender"> <file type="log4net.Util.PatternString" value="app_data/log/%property{LogName}" /> <rollingStyle value="Date" /> <appendToFile value="true" /> <rollingStyle value="Size" /> <datePattern value="yyyyMMdd" />