asp.net-core-1.0

ASP.NET CORE 1.0, Impersonation

落爺英雄遲暮 提交于 2020-01-03 08:56:09
问题 I'm writing an Intranet application. Target framework in project.json is dnx451. That's my publishing command: dnu publish --runtime dnx-clr-win-x86.1.0.0-rc1-update1 --no-source Database Connection string: Server=name;Database=name;Trusted_Connection=True; I'm trying to impersonate the database access but it's not working. When I start the application my windows user is recognized and it says Hello, Domain\Username on top right. As soon as I try to access the database I get the error "Login

'Microsoft.EntityFrameworkCore.Infrastructure.IDbContextFactory`1[TContext]' violates the constraint of type parameter 'TContext'

大城市里の小女人 提交于 2020-01-03 08:53:12
问题 It's my first time using asp 5\core1 and i'm having problem setting a entity framework dbcontext I have one class library with my object public class Utilizador { public Utilizador() { } public int id { get; set; } } Then i have a Web Api project with a reference to my class and a context public class Context : DbContext { public Context(DbContextOptions<Context> options) : base(options) { } public DbSet<Utilizador> Utilizadores { get; set; } } My package.json its like this regarding entity

'Microsoft.EntityFrameworkCore.Infrastructure.IDbContextFactory`1[TContext]' violates the constraint of type parameter 'TContext'

主宰稳场 提交于 2020-01-03 08:53:08
问题 It's my first time using asp 5\core1 and i'm having problem setting a entity framework dbcontext I have one class library with my object public class Utilizador { public Utilizador() { } public int id { get; set; } } Then i have a Web Api project with a reference to my class and a context public class Context : DbContext { public Context(DbContextOptions<Context> options) : base(options) { } public DbSet<Utilizador> Utilizadores { get; set; } } My package.json its like this regarding entity

Advanced features of Microsoft/Facebook authentifcation not available on Asp .Net Core RC1

一笑奈何 提交于 2020-01-02 07:34:26
问题 I'm working on a small ASP .NET Core RC1 application and I'm trying to implement the Microsoft/Facebook authentification. The following tutorial is really great and explain all the steps needed: http://www.oauthforaspnet.com/providers/microsoft/ But if I try to use the "advanced" features (like using the Provider property), this one is not available. I've added the following Nuget references in project.json: "Microsoft.AspNet.Authentication.Facebook": "1.0.0-rc1-final", "Microsoft.AspNet

Advanced features of Microsoft/Facebook authentifcation not available on Asp .Net Core RC1

南笙酒味 提交于 2020-01-02 07:34:12
问题 I'm working on a small ASP .NET Core RC1 application and I'm trying to implement the Microsoft/Facebook authentification. The following tutorial is really great and explain all the steps needed: http://www.oauthforaspnet.com/providers/microsoft/ But if I try to use the "advanced" features (like using the Provider property), this one is not available. I've added the following Nuget references in project.json: "Microsoft.AspNet.Authentication.Facebook": "1.0.0-rc1-final", "Microsoft.AspNet

Middleware to set response ContentType

穿精又带淫゛_ 提交于 2020-01-01 04:07:26
问题 In our ASP.NET Core based web application, we want the following: certain requested file types should get custom ContentType's in response. E.g. .map should map to application/json . In "full" ASP.NET 4.x and in combination with IIS it was possible to utilize web.config <staticContent>/<mimeMap> for this and I want to replace this behavior with a custom ASP.NET Core middleware. So I tried the following (simplified for brevity): public async Task Invoke(HttpContext context) { await

implementing roles in identity server 4 with asp.net identity

落爺英雄遲暮 提交于 2019-12-31 13:27:13
问题 I am working on an asp.net MVC application with identity server 4 as token service. I have an api as well which has some secure resources. I want to implement roles (Authorization) for api. I want to make sure that only an authorized resource with valid role can access an api end point otherwise get 401 (unauthorized error). Here are my configurations: Client new Client() { ClientId = "mvcClient", ClientName = "MVC Client", AllowedGrantTypes = GrantTypes.HybridAndClientCredentials,

Microsoft.AspNetCore.WebUtilities Line length limit 100 exceeded

爷,独闯天下 提交于 2019-12-31 01:50:21
问题 I've have been trying to automate a test in to upload a text file to a web api which uses flowjshandler, all running in c# .net core and linux docker containers. The test program uploads the file without exceptions when run from visual studio. However if I run the test program and web api inside a container I get this exception in the asp .net core web api framework: Line length limit 100 exceeded., Microsoft.AspNetCore.WebUtilities, at Microsoft.AspNetCore.WebUtilities.BufferedReadStream.d_

Filtering Out Properties in an ASP.NET Core API

守給你的承諾、 提交于 2019-12-30 21:37:30
问题 I want to serve up the following JSON in my API: { "id": 1 "name": "Muhammad Rehan Saeed", "phone": "123456789", "address": { "address": "Main Street", "postCode": "AB1 2CD" } } I want to give the client the ability to filter out properties they are not interested in. So that the following URL returns a subset of the JSON: `/api/contact/1?include=name,address.postcode { "name": "Muhammad Rehan Saeed", "address": { "postCode": "AB1 2CD" } } What is the best way to implement this feature in ASP

Create RSS feed in asp.net core 1.0

会有一股神秘感。 提交于 2019-12-30 10:56:53
问题 I am working in Asp.net Core 1.0 MVC 6 I am trying to write a component to provide RSS feeds from my websites. I found this post that suggests that System.ServiceModel.Syndication has yet to be ported to ASP.NET CORE. I am unable to target the full .NET framework. The suggestion is to write as an xml parser. I am however struggling to get my head around everything that might be required. I have built the functionality to get my data into XML but now need to better understand how to allow this