Questions tagged [asp.net-core-2.0]

1

votes
0

answer
249

Views

HTTP Error 502.5 - Process Failure in .Net core 1.1

It was not possible to find any compatible framework version The specified framework 'Microsoft.NETCore.App', version '1.1.2' was not found. Check application dependencies and target a framework version installed at: Alternatively, install the framework version '1.1.2'. I installed Windows (Server H...
Shah Niral
1

votes
1

answer
1.4k

Views

.NET Core 2.0 API with EF6 and .edmx file?

I want to build a API using .NET Core 2.0 that targets the full .NET framework so I can work with Entity Framework 6 and an .edmx file. Is this possible? How do I inject the DbContext generated by the .edmx file? I want to do this because my project works with a lot of stored procedures and I don't...
genzop
1

votes
1

answer
99

Views

Why is my post data all null when posting with HttpClient?

I am trying to post an object from a client web app to a CRUD API for said client. I am using the following code to make the post request: var respP = await _client.PostAsync('api/Persons', new StringContent(JsonConvert.SerializeObject(person), Encoding.UTF8, 'application/json')); And the API action...
ProfK
1

votes
1

answer
861

Views

Database connection not created in IdentityDbContext

I'm trying to authentication Asp.Net Core 2 Web API with Asp.Net Identity 2. Here's my code for the AuthController and the databasecontext: public AuthController(UserManager userManager, SignInManager signInManager, RoleManager roleManager , IPasswordHasher passwordHasher, IConfiguration configurati...
devC
1

votes
1

answer
726

Views

Add custom Font to .NET Core 2.0 Angular

I have a .NET Core 2.0 app using the Angular 2 Template. The problem is that I can't add a custom font (woff2) to the app.component.css @font-face { font-family: 'FrutigerBold'; src: url('./assets/fonts/frutiger65_bold.woff2') format('woff2'); } And get the following error: NodeInvocationException:...
1

votes
0

answer
67

Views

Refresh user's permissions after removed from a role

I have a project where I can assign users to roles. My problem is that when I remove a user from a role, the user will be able to access the resources that he is no loger supposed to see. The only way to refresh his permissions is when he log off and login again. This is a problem because when I wan...
pitaridis
1

votes
1

answer
301

Views

DotNetCore.NPOI & .Net Core 2 MVC Web App

I am using DotNetCore.NPOI V1.0.2 in my .NET Core 2 MVC web app. I have been researching for instructions or examples to create .docx document with header and footer without any success. Does anyone know how to create two lines header and footer with page numbers like Page 1/x format?
Charles Yang
1

votes
0

answer
268

Views

Creating recursive method helper with Func<>

I have two method helper with theses signatures: @helper CreateNavigation(int parentId, int depthNavigation) @helper Navigation(int parentId, int depthNavigation) I have tried to convert it to a proper method for using in ASP.NET Core 2. But I got an error in VS2017 IDE that is: 1- Use of unassigne...
Jahan
1

votes
0

answer
347

Views

LinkedIn Authentication using OAuth2.0 in ASP.NET Core 2.0

I am trying to use the LinkedIn authentication in my asp.net core 2.0 app. I am following this article as an example, but its using Core 1.0: Authenticating a user with LinkedIn in ASP.NET Core Some of the code updates to move to Core 2.0 I have made are in the registration of the middleware: publi...
Reza
1

votes
0

answer
485

Views

How to create user defined functions using code first in ABP?

I want to create some user-defined functions using code first approach in abp framework. I have created stored procedures xyz by adding xyz.sql inside EntityFrameworkCore\Migrations\Stored Procedures folder, But not able to find a way to create a function, please help.
vivek nuna
1

votes
1

answer
482

Views

Asp.Net Core Azure AD V1.0 JWT Authentication Invalid Signature

I have to make an ASP.NET Core 2.0 Web API application which uses the resources of Microsoft Graph. I tried to make the app use JWT authentication with the following properties: Audience: 'CLIENT_ID'; Authority: 'https://login.microsoftonline.com/TENANT_ID' The idea here is that I have a SPA app whi...
Abraxas
1

votes
0

answer
245

Views

Bootstrap navbar styling issue in ASP.NET Core Web Application template

Did anyone else notice that for the longest time there has been a bug in the _LoginPartial.cshtml of the ASP.NET Core Web Application template (w/ Individual User Accounts)? Hello @UserManager.GetUserName(User)! Log out The navbar-right class being on both the form and ul elements causes a margin is...
Blake Rivell
1

votes
0

answer
129

Views

How do I get the model state from a HTTPRequestResponse from within a console application

I have an APS.NET Core 2.0 API that I am writing a test client for. The test client is a console application. I want to be able to read and display any errors returned from may API call that would be in the model state. In my API, if the model is not valid, I return the model along with a status 422...
EiEiGuy
1

votes
2

answer
356

Views

ASP.Net Core - EntityFrameworkCore data is not adding, updating instead

I am using ASP.Net Core 2 and Entity Framework Core with MySQL. I want to add a simple entity to the database. My Model is like this- public class Employee { public int Id { get; set; } [Required] public string Name { get; set; } [Required] public string City { get; set; } [Required] public string D...
IT Eng - BU
1

votes
2

answer
749

Views

Is there a way to deserialize CSV to object, mapping by varied column names?

I would like to deserialize CSVs to objects, mapping by varied column names, as illustrated by the following examples: Input 1 Id;Name;Document 1;Matheus;555777 2;Clarice;567890 Input 2 'Id_Person';'First_Name';'Phone' 3;'John';'999-9999' public class People { public int PersonId { get; set; } publi...
Matheus Lacerda
1

votes
1

answer
231

Views

Referencing .NET 4.7.1 library using Azure Storage from ASP.NET Core 2 MVC App

In my solution I have an ASP.NET Core 2 MVC app using Razor pages, a Web API 2 app and a .NET 4.7.1 class library containing services and their definitions that use Azure Table Storage from the Azure Storage NuGet (v8.7.0). I'm using autofac for dependency injection. I have hooked up both my web app...
James Mundy
1

votes
0

answer
43

Views

Precompiled Views and CompilationCallback

I've defined a compilation callback for my MVC views like var mvc = services.AddMvc(); mvc.AddRazorOptions(razorSetup => { razorSetup.CompilationCallback = context => { // context.Compilation = context.Compilation.AddReferences(...) }; }); This works great - and while debugging, there's no problem -...
Wolfgang Kluge
1

votes
0

answer
1.2k

Views

Could not load type 'Microsoft.EntityFrameworkCore.Infrastructure.DesignTimeProviderServicesAttribute'

I use Visual Studio for Mac, created a .net core web api project. The csproj file is like this: netcoreapp2.0 When I execute 'dotnet ef dbcontext scaffold' to scaffold from MySQL with the following command: dotnet ef dbcontext scaffold 'server=[server];port=3306;user=[user];password=[password];datab...
Ternence.Lin
1

votes
0

answer
104

Views

How to add an asmx service in asp.net core 2.0 and access it from javascript

I'm trying to add a asmx service to an asp.net core 2.0 application. First it doesn't allow me to add a new asmx service (since it's a .net core application). So I did Add Existing Item and added an existing asmx service. But I'm unable to access it from javascript. It gives a 404 error in the brows...
AbdiasM
1

votes
0

answer
285

Views

.Net Core 2.0 custom authenticantion: pass logged user id to controller

Our company has a custom authentication scheme that I have to use. In my .NET Core 2.0 Web API I will receive a token in each requisition and resend it to a validation service. I'm currently using an overridden HandleAuthenticateAsync, and if the validation checks out, I need to somehow send the use...
Matheus Lacerda
1

votes
1

answer
790

Views

Role authorization in .net core 2.0 using Identity

I am using .net core 2.0 and trying to do authorization using asp identity in a mvc website. (Authentication is done using Google OAuth). Authentication is working fine i.e users can access controllers/views after logging in through google. But when I try adding a role('Admin') to a particular contr...
vicky99
1

votes
0

answer
196

Views

Asp.Net Core Integration with Identity Server 4 Token Server

I'm implementing jwt implicit authentication from Identity Server 4 in a new ASP.NET Core 2.0 Application, but confused on how to get my claims set on the context. services.AddAuthentication(options => { options.DefaultAuthenticateScheme = IdentityServerAuthenticationDefaults.AuthenticationScheme; o...
johnny 5
1

votes
1

answer
374

Views

How to access Model object in ActionFilterAttribute.OnResultExecuted?

I am working with a WEB API application in ASP .NET Core 2.0 where I have a custom filter attribute that inherits from ActionFilterAttribute. How can I access the Model object passed to a controller action in POST call, in ActionFilterAttribute.OnResultExecuted() The mentioned method is passed a Res...
Farooq Hanif
1

votes
1

answer
511

Views

Can not find compilation library location for package 'NReco.PdfGenerator'

I am trying to use NRecosite HTML to PDF generator. Whenever it comes to new NReco.PdfGenerator.HtmlToPdfConverter() it throws exception FileNotFoundException: Could not load file or assembly 'System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find t...
maxspan
1

votes
2

answer
243

Views

Taghelper not rendering after upgrade to asp.net core 2.0

I have upgraded my application to asp.net core 2.0 and now my taghelpers are not rendering. I have made no change in my code. Below is my _ViewImport.cshtml and labeltaghelper.cs. Also while doing build I am getting warning 'Microsoft.AspNet.Mvc.TagHelpers 6.0.0-rc1-final' was restored using '.NETF...
maxspan
1

votes
1

answer
887

Views

getting exception System.Runtime.Remoting.ObjectHandle while using XMLWorkerHelper in asp.netcore 2.0 with Itextsharp

I am trying to use ItextSharp to generate pdf but I am getting a exception on XMLWorkerHelper.GetInstance().ParseXHtml(writer, pdfDoc, sr); MissingMethodException: Method not found: 'System.Runtime.Remoting.ObjectHandle System.Activator.CreateInstance(System.String, System.String)'. What am I missi...
maxspan
1

votes
1

answer
837

Views

Slow response from Identity Server 4.0 (asp.net core 2.0) on connect/token endpoint on high load

We have setup Identity Server 4 with Entity Framework Core. We successfully created and Seeded the desired Client to the MSSQL Database and deployed both the Project and the Database to one and the same AWS Datacenter. In our Startup.cs class we have: .AddInMemoryCaching() .AddClientStoreCache() ....
Mariyan Stefanov
1

votes
0

answer
132

Views

ASP.NET Core 2 multi-authentication methods

I'm trying to do what seems to me a common use case, but I cannot find much documentation or examples. I have a website that has a UI and a set of web services which would only be accessed by other applications. Users log into the UI using AzureAD (though I would also like to have users that don't h...
Zack
1

votes
0

answer
77

Views

.Net Core 2.0 Publish Error Angular SPA

I am having an issue when publishing my .Net Core 2.0 Angular SPA from Visual Studio 2017 Community. The site compiles and runs fine through the debugger. When I try to publish (to ftp) I get the following error; The command 'node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js...
Matthew Flynn
1

votes
0

answer
274

Views

Can the Asp.Net Core Data Protection System detect the configuration has changed and generate a new key?

I'm creating a new asp.net core 2 website that's using data protection as per this article. As a first pass I created this without protecting the keys (since we're not in production yet) e.g. public void ConfigureServices(IServiceCollection services) { services.AddDataProtection() .PersistKeysToFile...
Gavin Sutherland
1

votes
0

answer
38

Views

Use common table name across inheritance in ef core

I am new to entity framework and started playing around with it. I am trying to use my usual structure that consists of a Core project that has raw properties. DataAccess extends core classes and adds any additional db specific property and the DBContext in this case. Business extends DataAccess and...
Neville Nazerane
1

votes
0

answer
197

Views

IdentityServer4 - MVC app hosts Aurelia SPA + WebAPI

I'm trying to do something that seems like it would be a straightforward thing. I've looked through the IS4 QuickStarts and found a bunch of things regarding OAuth online, but with the latest changes to Core 2.0, I'm having trouble finding an example of just how to do this. Lots of stuff that's clos...
compgumby
1

votes
0

answer
156

Views

dotnet core 2.0 - programmatically attach the VS2017 debugger to a process

In my dotnet core 2.0 application I re-launch the same application in a different process (with some different arguments) at a certain point. I want to be able to programmatically attach the current Visual Studio (2017) debugger to the new process. Here is an example of how it is done in full framew...
Tom
1

votes
0

answer
102

Views

.net core 2.0 use google login and then HttpRequestException: An error occurred while sending the request

I tried it in vs Development mode, and it can work and I can login, but when I make it in my server, when I login, it says An unhandled exception occurred while processing the request. WinHttpException: 与服务器的连接意外终止 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()...
Shuang Fan
1

votes
0

answer
29

Views

How to make AWS ELB and AspNetCore routing work together?

I am hosting a set of Asp.Net Core 2.0 apps on AWS Fargate, behind a single ELB load balancer that has multiple roles to route to different microservices in order to hide that microservice complexity from the clients. I have 3 rules set as follows: /auth* -> AuthMicroservice /reports* -> BI Microser...
Machinarius
1

votes
2

answer
234

Views

Adding [FromBody] attribute causes 404

I have an Action that takes a simple string parameter I send data to it using Ajax like this: [HttpPost] public async Task Add(string data) $.ajax({ type: 'POST', url: '/Items/Add', data: { data: item } }) This works fine, but after reading about model binding simple types in ASP.NET Core I learned...
Valuator
1

votes
2

answer
307

Views

Remove authentication required popup on Azure Active directory with .net core

I am using .net core 2.0 application with ADFS for authentication. When I access web app from linux, I get additional authentication required po up on office network. Pop up not asked in outside office network or office device. i need to remove the additional popup or enter user credentials with Nig...
BlackPOP
1

votes
1

answer
253

Views

EPPlus v4.5.0.2rc Asp.Net Core MVC 2.0 w/ .NET 4.7 platform - corrupt data

Answer: Turns out the axios lib (ajax) needs to have the content type set to blob. **I checked other, older, code and did not have to do that but once I did it worked. axios.get(HS.Routes.Test.TestExcelDT(), { responseType: 'blob' }) Preface: I have been using EPPlus for several years with no probl...
Tab
1

votes
0

answer
253

Views

ASP.NET Core 2.0 unauthorized redirect using path only

I have an application which is accessed via HTTPS, but is 'reverse proxied' to the server using plain HTTP. It is set up on AWS as follows: [BROWSER] --(https)--> [ELB] --(http)--> [SERVER] Everything works fine except when a page is being accessed by an unauthenticated user, the server responds wit...
aljo f
1

votes
0

answer
127

Views

I can not use signin-google to login my .net core 2.0

I do the same as this link, and I can use google to login with Default debugging, but when I make it in server, it can not work and return 500 error, in the packet ,it loss Location and Cookie,i also make it in docker ,but the same error ,so how can i do for it ? services.AddAuthentication().AddGoog...
Shuang Fan

View additional questions