asp.net-web-api

Save Changes of IConfigurationRoot sections to its *.json file in .net Core 2.2

天大地大妈咪最大 提交于 2020-05-14 10:01:47
问题 i was digging to find out the solution but didn't manage to find it, i bet that someone has encountered this problem, so what is the problem?. For test i have created simple console application (solution will be used in asp.net core web api). I have TestSetting.json configuration file with 'Copy Always' setuped. { "setting1" : "value1" } And Simple code IConfigurationBuilder configurationBuilder = new ConfigurationBuilder(); IConfigurationRoot configuration = configurationBuilder.AddJsonFile(

ASP.NET Web Api join two tables to make an array of objects

别说谁变了你拦得住时间么 提交于 2020-05-13 09:00:53
问题 This might be already asked question but I still can't solve my problem. I don't even know if I am on the right path. Some help will be appreciated. I have two model classes in an ASP.NET Web API project looking like this: namespace Artists.Models { public class Artist { public int ArtistID { get; set; } public string ArtistName { get; set; } } } and : namespace Artists.Models { public class Project { public int ProjectID { get; set; } public string ProjectName { get; set; } public int

ASP.NET Web Api join two tables to make an array of objects

折月煮酒 提交于 2020-05-13 08:59:15
问题 This might be already asked question but I still can't solve my problem. I don't even know if I am on the right path. Some help will be appreciated. I have two model classes in an ASP.NET Web API project looking like this: namespace Artists.Models { public class Artist { public int ArtistID { get; set; } public string ArtistName { get; set; } } } and : namespace Artists.Models { public class Project { public int ProjectID { get; set; } public string ProjectName { get; set; } public int

ASP.NET Web Api join two tables to make an array of objects

主宰稳场 提交于 2020-05-13 08:58:06
问题 This might be already asked question but I still can't solve my problem. I don't even know if I am on the right path. Some help will be appreciated. I have two model classes in an ASP.NET Web API project looking like this: namespace Artists.Models { public class Artist { public int ArtistID { get; set; } public string ArtistName { get; set; } } } and : namespace Artists.Models { public class Project { public int ProjectID { get; set; } public string ProjectName { get; set; } public int

OData on .Net Core doesn't return the right results on $select

那年仲夏 提交于 2020-05-12 18:58:50
问题 I've added OData to my WebAPI project. Versions: Core 3.1 OData 7.3.0 (beta version in order to work with Core 3.x) EF Core 3.1.0 Here is my startup.cs public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } public void ConfigureServices(IServiceCollection services) { services.AddDbContext<Models.Contexts.EntityContext>(opts => opts.UseSqlServer(Configuration["ConnectionString:MailBackup"])); services

OData on .Net Core doesn't return the right results on $select

久未见 提交于 2020-05-12 18:52:52
问题 I've added OData to my WebAPI project. Versions: Core 3.1 OData 7.3.0 (beta version in order to work with Core 3.x) EF Core 3.1.0 Here is my startup.cs public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } public void ConfigureServices(IServiceCollection services) { services.AddDbContext<Models.Contexts.EntityContext>(opts => opts.UseSqlServer(Configuration["ConnectionString:MailBackup"])); services

EnableCors C# .NET Core 3

拈花ヽ惹草 提交于 2020-05-12 02:43:38
问题 I'm working on a C# API and doing a GET request from my frontend and for that to happen I need to enable cors in my API, but I can't seem to do it! It's a .NET Core 3 API and I've tried following this tutorial and I've also tried installing the 2.2 NuGet Package for it via: dotnet add package Microsoft.AspNetCore.Cors --version 2.2.0 But I still get a cors error when doing my GET request. When trying the [EnableCors] annotation I get an error saying "The EnableCorsAttribute could not be found

EnableCors C# .NET Core 3

孤街醉人 提交于 2020-05-12 02:41:55
问题 I'm working on a C# API and doing a GET request from my frontend and for that to happen I need to enable cors in my API, but I can't seem to do it! It's a .NET Core 3 API and I've tried following this tutorial and I've also tried installing the 2.2 NuGet Package for it via: dotnet add package Microsoft.AspNetCore.Cors --version 2.2.0 But I still get a cors error when doing my GET request. When trying the [EnableCors] annotation I get an error saying "The EnableCorsAttribute could not be found

Get request origin in C# api controller

為{幸葍}努か 提交于 2020-05-10 07:31:07
问题 Is there a way how can I can get request origin value in the api controller when I'm calling some api endpoint with ajax call? For example I'm making this call from www.xyz.com: $http({ url: 'http://myazurewebsite.azurewebsites.net/api/ValueCall/CheckForExistingValuers', method: "GET", params: { loanID: $scope.loanIdPopup } }).success(function (data) { }).error(function (data) { }); Once on the api side, how can I get the www.xyz.com value? CORS is working properly. 回答1: What you're looking

I get a 400 bad request - invalid Url when the length of the request exceeds 320+ characters

北慕城南 提交于 2020-05-10 00:43:54
问题 Not sure what could be the reason. Added the following in Web.config also. maxUrlLength="1024" maxQueryStringLength="1024" requestPathInvalidCharacters="" maxRequestLength="1024" relaxedUrlToFileSystemMapping="true" I encode the uri parameter and send the request but get a invalid url all the time. Url: http://localhost:51840/api/xxxxxxx/xxxxxxxxxxxx/n4cEF3OM0LC0q8I6OMe0XdHo8evXnoeyC06A%252fL%252fu0a%252f6e0RQrdxl2%252fPkSKNfh4aEQm78TReX1zIfGDB1bgH%252bGBEI%252fBw6i0DwQ6