.net-core

How to update target framework of .net project?

廉价感情. 提交于 2021-01-29 11:08:20
问题 I had created a project in .Net Core 2.0 and now with the new release of .Net Core 2.1, I want to update to it. So is it just ok that I go to project properties and update Target Framework to 2.1 or do I also need to make any change in my code? According to this article https://docs.microsoft.com/en-us/aspnet/core/migration/20_21?view=aspnetcore-2.1, Microsoft.AspNetCore.All package is now replaced by Microsoft.AspNetCore.App. So I want to ask if I don't update this package, will anything

How do I process a file from a memory stream?

随声附和 提交于 2021-01-29 11:02:12
问题 I am posting one or more files from my Vue.js frontend. It's being done as such: <form enctype="multipart/form-data" novalidate v-if="isInitial || isSaving"> <div class="dropbox"> <input type="file" multiple :name="uploadFieldName" :disabled="isSaving" @change="filesChange($event.target.name, $event.target.files); fileCount = $event.target.files.length" accept=".json" class="input-file"> <p v-if="isInitial"> Drag files here to begin <br> or click to browse </p> <p v-if="isSaving"> Uploading {

Microsoft.Configuration.Extensions: How to get section / complex value as json string?

送分小仙女□ 提交于 2021-01-29 10:59:32
问题 When we have configuration like this // appsettings.json { "SomeServiceConfiguration": { "Server": "127.0.0.1", "Port": "25" } } it is possible to use binding to access data: IConfiguration configuration = ...; var section = configuration.GetSection("SomeServiceConfiguration"); var val = section.Value; // this is null var t = new SomeServiceConfiguration(); section.Bind(t); But is it possible to get value (section content) "just as string" (by the fact as json) {"Server": "127.0.0.1", "Port":

how to log custom messages to azure portal analytics monitoring logs

陌路散爱 提交于 2021-01-29 10:31:56
问题 I am trying to add custom logs in my c# asp dot net core web api. I am able to find the api calls logs in Azure portal -> application insights -> logs. But i am not able to find the custom logs i am entering using below code. whats the place to search for them. public async Task Invoke(HttpContext httpContext) { // First, get the incoming request var request = await FormatRequest(httpContext.Request); // TODO: Save log to chosen datastore _logger.LogInformation('custommessage101'); // ------

Claims Identity .NET CORE 3.0 API JWT

不打扰是莪最后的温柔 提交于 2021-01-29 10:17:05
问题 I'm trying to develop a web API on .NET CORE 3.0 but I can't get userId from the controller this is my StartUp RSAParameters keyParams = RsaKeyUtils.GetKeyParameters("jwt_key.conf"); var key = new RsaSecurityKey(keyParams); services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddJwtBearer(options => { options.TokenValidationParameters = new TokenValidationParameters() { IssuerSigningKey = key, ValidAudience = GappedAuthSettings.TokenAudience, ValidIssuer = GappedAuthSettings

Passing command line arguments to WPF Core 3.0 sideloaded application

|▌冷眼眸甩不掉的悲伤 提交于 2021-01-29 10:04:21
问题 I have a WPF app that runs on Core 3.0. I published it via Windows Application Packaging Project. Because it's WPF app, I needed to add this to appxmanifest: <Extensions> <uap5:Extension Category="windows.appExecutionAlias" Executable="MyApp.exe" EntryPoint="MyApp"> <uap5:AppExecutionAlias> <uap5:ExecutionAlias Alias="MyApp.exe" /> </uap5:AppExecutionAlias> </uap5:Extension> </Extensions> Then I published the WPF app as sideloaded and it works just fine when I start it from the Windows Start

dotnet Command executed by visual studio 2017

我们两清 提交于 2021-01-29 09:42:28
问题 I am looking for a way to get all dotnet command send by Visual studio while creating project or new files. My goal is to automatise the construction of the code using templates and scripting. Is there a way to get all dotnet Command executed by Visual Studio ? Thanks a lot for your answer Regards Mickael 回答1: You can use Process Monitor to write a log of all executed dotnet processes with parameters. 来源: https://stackoverflow.com/questions/52986734/dotnet-command-executed-by-visual-studio

Is GetHashCode guaranteed to be the same for the lifetime of an object?

一世执手 提交于 2021-01-29 09:42:14
问题 I hate to beat a dead horse. In @eric-lippert's blog, he states: the hash value of an object is the same for its entire lifetime Then follows up with: However, this is only an ideal-situation guideline So, my question is this. For a POCO (nothing overriden) or a framework (like FileInfo or Process ) object, is the return value of the GetHashCode() method guaranteed to be the same during its lifetime? P.S. I am talking about pre-allocated objects. var foo = new Bar(); Will foo.GetHashCode()

The model item passed into the is of type 'LoginModel', but this instance requires a model item of type 'HomeViewModel'

本秂侑毒 提交于 2021-01-29 09:26:14
问题 The full text of the error I am getting An unhandled exception occurred while processing the request. InvalidOperationException: The model item passed into the ViewDataDictionary is of type 'FashionNova.Web.Areas.Identity.Pages.Account.LoginModel', but this ViewDataDictionary instance requires a model item of type 'FashionNova.Web.ViewModels.HomeViewModel'. This is my HomeController namespace FashionNova.Web.Controllers { using FashionNova.Services; using FashionNova.Web.ViewModels; using

Connecting to API with Angular Webapp using Minikube and Kubernetes

萝らか妹 提交于 2021-01-29 09:24:52
问题 I'm trying to learn Kubernetes and would like to create a simple example of an Angular frontend in a Docker container connecting to a .NET Core API also on a Docker container. I am able to successfully create both the API and the frontend and can see the result on the browse but struggle to retrieve information from the API on the frontend. As the IP of the API changes I can't hardcode those values in the Angular app before building the image but using the DNS name doesn't seem to work either