asp.net-core-1.0

ASP.NET Core Compression Middleware - Empty Reponse

此生再无相见时 提交于 2019-12-12 01:47:31
问题 I am using some custom compression middleware from this repository (pasted below). Upon the first request, the content is compressed just fine. For every request after that, the response comes back as completely empty (with a Content-Length of 0). This only started happening after migrating from ASP.NET Core RC2 to RTM. Does anyone know why this is happening? CompressionMiddleware: public class CompressionMiddleware { private readonly RequestDelegate _next; public CompressionMiddleware

How to get access_token, id_token from authorize endpoint of IdentityServer4?

痞子三分冷 提交于 2019-12-11 07:28:25
问题 This question is actually a continuous question of this SO question of mine. I am trying to get access_token and id_token from Identityserver4 by using Authorization code flow. But, If I try to access "Authorize" endpoint, I got 405 (method not allowed) HTTP error. HTTP GET Request http://localhost:2000/connect/authorize? client_id=client &client_secret=secret &grant_type=authorization_code &username=admin &password=admin &response_type=id_token+token &scope=openid+profile+offline_access

Error while adding AddOptions in Startup.cs

≯℡__Kan透↙ 提交于 2019-12-11 06:42:34
问题 I am trying to implement options pattern as mentioned in this link - https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration#options-example When I add these 2 lines in ConfigureServices of Startup.cs public void ConfigureServices(IServiceCollection services) { // Setup options with DI services.AddOptions(); services.Configure<AppSettingsModel>(Configuration); I get below call is ambiguous between the following methods or properties error- call is ambiguous error screenshot My

Cannot connect to SQL Server on ASP.NET Core 1 EF7

て烟熏妆下的殇ゞ 提交于 2019-12-11 05:24:12
问题 I am trying to connect to SQL Server 2014 or 2016 from an ASP.NET Core 1.0 web application (Entity Framework Core). I am getting the error below. Any tips how to resolve it. I can successfully connect to the DB from through Visual Studio 2015 SQL Server Object Explorer. However the connection from the web application fails. Neither I can do dotnet ef database update . I can connect to LOCALDB. My connection string looks like: "DefaultConnection": "Data Source=server;Initial Catalog=TestDb

Analog System.Security.Permissions in .NET Core

早过忘川 提交于 2019-12-11 05:21:01
问题 I am trying to port project to .NET Core, but can't find analog System.Security.Permissions. Project uses construction like that [PermissionSetAttribute(SecurityAction.LinkDemand, Name = "FullTrust")] or [EnvironmentPermission(SecurityAction.LinkDemand, Unrestricted = true)] , '' 回答1: Code Access Security isn't and won't be available in .Net Core. Since all code is effectively running under full trust, it should be enough to remove those attributes. If you actually want to restrict some code,

Getting Controller details in ASP.NET Core

不问归期 提交于 2019-12-11 04:07:33
问题 In ASP.NET 4.x, there is a ReflectedControllerDescriptor class which resides in System.Web.Mvc . This class provides the descriptor of a controller. In my previous applications, I used to do this: var controllerDescriptor = new ReflectedControllerDescriptor(controllerType); var actions = (from a in controllerDescriptor.GetCanonicalActions() let authorize = (AuthorizeAttribute)a.GetCustomAttributes(typeof(AuthorizeAttribute), false).SingleOrDefault() select new ControllerNavigationItem {

net core 1 (dnx 4.5.1) with enterpriselibrary 6 - setting up the connection string

狂风中的少年 提交于 2019-12-11 02:22:07
问题 i ve big problems running enterprise library data access block with net core 1 (dnx 4.5.1) How can i setup the default connection string for entlib my appsettings.json "ConnectionString": "Server=localhost\sqlexpress;Initial Catalog=blind;User Id=blind;Password=blind" Here is my problem (no default connectionstring) Database db = DatabaseFactory.CreateDatabase(); how can i pass the appsettings ConnectionString to the entlib databasefactory any help would be greatly appreciated 回答1: I know it

Access _context in an ASP.NET Core MVC Model

淺唱寂寞╮ 提交于 2019-12-11 00:15:01
问题 I'm trying to interact with the database from within a Model in an ASP.NET Core 1.0 MVC project. Scaffolding has been used to create Controllers and views from the Models. Ideally I would like to access it like I would in a controller with the _context but I failed finding a way to do so. I also tried to create a new connection from the model: using (var context = new ApplicationDbContext()){ // Code here } But the ApplicationDbContext constructor requires options arguments like the default

Identity value generation can only be used with signed integer properties after upgrade to EF Core 1.1

不羁的心 提交于 2019-12-11 00:04:27
问题 When I updated "Microsoft.EntityFrameworkCore.Tools.DotNet" to version "1.1.0-preview4" , entity framework has stopped to generate migrations. Error: dotnet : System.ArgumentException: Identity value generation cannot be used for the property 'UID' on entity type 'SomeEntity' because the property type is 'Guid'. Identity value generation can only be used with signed integer properties. 回答1: Solution is get rid of attribute [DatabaseGenerated(DatabaseGeneratedOption.Identity)] [Key] //

'IConfiguration' does not contain a definition for 'Get'

戏子无情 提交于 2019-12-10 23:59:43
问题 Originally I had the code in 1.0.0-rc1-beta6. public static IConfiguration Configuration { get; set; } public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv) { // Setup configuration sources. var builder = new ConfigurationBuilder(appEnv.ApplicationBasePath) .AddJsonFile("config.json") .AddEnvironmentVariables(); Configuration = builder.Build(); var test = Configuration.Get("ASPNET_ENV"); } Now I want to use 1.0.0-rc1-update, the code is: public Startup(IHostingEnvironment