asp.net-core-mvc

Error while doing Migrations EF core 2.0, changing Identity id from string to int

十年热恋 提交于 2020-01-14 07:55:29
问题 Scenario: I have received auto generated project in ASP.NET CORE from my colleague. There is auto-generated code for Account/Manage service. This code includes ApplicationUser Class, DBContext and migration folder with 00000000000000_CreateIdentitySchema.cs and 20180323155805_Snapshot.cs. I have been trying to change my User class to have integer id. To do that I added generic to IdentityUser: public class ApplicationUser : IdentityUser**<int>** { } I also had to create ApplicationRole class,

Getting 401 accessing secured page with JwtToken under IDS4 and ASP.NET Core 2.2

纵饮孤独 提交于 2020-01-13 20:50:14
问题 I have configured the MVC client by adding the following lines. services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddJwtBearer(); The error message was, as (kind of) expected, 401 Unauthorized. So I added config for the bearer as suggested by Microsoft. services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddJwtBearer(_ => { _.Authority = "http://localhost:5000"; _.Audience = "http://localhost:5002"; }); In my solution, port 5000 hosts the IDS4 provider and

ASP.NET Core MVC Loading Session Asynchronously

泪湿孤枕 提交于 2020-01-13 19:41:58
问题 I have been reading the official Session and application state documentation and have stumbled upon the following paragraph: Loading Session asynchronously The default session provider in ASP.NET Core loads the session record from the underlying IDistributedCache store asynchronously only if the ISession.LoadAsync method is explicitly called before the TryGetValue , Set , or Remove methods. If LoadAsync is not called first, the underlying session record is loaded synchronously, which could

ASP.NET Core MVC Loading Session Asynchronously

痞子三分冷 提交于 2020-01-13 19:41:11
问题 I have been reading the official Session and application state documentation and have stumbled upon the following paragraph: Loading Session asynchronously The default session provider in ASP.NET Core loads the session record from the underlying IDistributedCache store asynchronously only if the ISession.LoadAsync method is explicitly called before the TryGetValue , Set , or Remove methods. If LoadAsync is not called first, the underlying session record is loaded synchronously, which could

How to get Action and Controller name in ASP.Net Core MVC app?

孤者浪人 提交于 2020-01-13 16:24:06
问题 How to get Action and Controller names in ASP.Net MVC Core RC1 Application in Startup.cs ? I want to create a middleware and log the information (I want to Log detailed response to my Database, so I need Action and Controller info.) after following code in configure method of startup.cs - app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=User}/{action=Index}/{id?}"); }); //Want to get Action and controller names here.. 回答1: You'll want to inject the

How do I set the TypeScript compiler version for an ASP.NET 5 MVC 6 project in Visual Studio 2015 RC?

℡╲_俬逩灬. 提交于 2020-01-13 10:54:28
问题 So I'm now at my witts end with this one. As the question in the title asks, I'm trying to set the tsc version for a sample ASP.NET 5 MVC 6 project. I'm using Visual Studio 2015 RC and I want to compile TypeScript using version 1.5 Beta that was recently released. In VS 2013, this was an option page in the project properties. I thought there would be some magic project.json value I could set, but nope. If I could even turn off the compilation (version 1.4) and use a Gulp task, even that would

Using IApplicationBuilder.Map generates nested paths with UseMvc

…衆ロ難τιáo~ 提交于 2020-01-13 10:34:08
问题 I'm trying the new asp.net 5 alongside VSNET 2015 RC. Configuration of my webapp: Microsoft.AspNet.Mvc 6.0.0-beta4 I'm really confused about this behavior: if i use public void Configure(IApplicationBuilder app, IHostingEnvironment env) { ... app.UseMvc(); } everything works. I call my controller via http://localhost:1234/api/values and all is ok. For the sake of my testing if i change the snippet above in public void Configure(IApplicationBuilder app, IHostingEnvironment env) { ... app.Map("

.net Core - Default controller is not loading when Route attribute is used

夙愿已清 提交于 2020-01-13 08:45:16
问题 A new .net core web application project comes with the following route configuration: app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); If you replace this with app.UseMvc() and add appropriate Route attributes for both HomeController and its actions (Index, About, Contact, Error), it would still work. Since we're not specifying a default route, the default view (Home/Index) will not be rendered if you hit http://localhost:25137/

Will there be a SSRS reportviewer in ASP.NET 5 MVC 6?

别来无恙 提交于 2020-01-13 05:12:05
问题 I am working on upgrading an ASP.NET 4.0 WebForms app to MVC6 and cannot find a solution for displaying SSRS reports. With the absents of System.Web the Microsoft ReportViewer control no longer works. What is the best practice for displaying SSRS reports on the web in ASP.NET 5? 回答1: @Brian - ASP.NET MVC 6 is still in beta stage, its very early to plan for upgrading ASP.NET 4 web forms to MVC 6. Please try using ASP.NET MVC 5 for upgrading web forms, it (MVC5) will be there for many years to

.NET Core EndRequest Middleware

杀马特。学长 韩版系。学妹 提交于 2020-01-13 03:54:09
问题 I'm builing ASP.NET Core MVC application and I need to have EndRequest event like I had before in Global.asax. How I can achieve this? 回答1: It's as easy as creating a middleware and making sure it gets registered as soon as possible in the pipeline. For example: public class EndRequestMiddleware { private readonly RequestDelegate _next; public EndRequestMiddleware(RequestDelegate next) { _next = next; } public async Task Invoke(HttpContext context) { // Do tasks before other middleware here,