asp.net-core-webapi

Dotnet core + (plus) sign in Web API routing

主宰稳场 提交于 2019-12-23 08:59:53
问题 I work on web API project in the dotnet core and check user mobile number exists check. [Route("api/[controller]")] public class UserController : Controller { [HttpGet] [Route("mobile/exist/{mobile}/{id:int?}")] public async Task<IActionResult> MobileExist(string mobile, int? id) { return Json(await _userService.MobileExist(mobile, id)); } } Request URL: http://localhost:3364/api/user/mobile/exist/+123456 When I request above URL with the plus sign it given an error. The Same URL without +

Moving .Net Core Web-API to AWS Web Api Gateway

帅比萌擦擦* 提交于 2019-12-23 05:28:01
问题 I have a Web-API developed with .Net Core.It has few end points ( GET / POST ). The requirement is to move that to AWS API-Gateway. That Web-API is built using layered architecture, it has a business layer that talks to Db layer that got some entity framework repositories ( backend database Postgres). Now i have re-created my solution as a AWS Serverless solution ( using one of the template projects that comes with AWS Toolkit for visual studio). The question is how to make my web api methods

Re-use already authenticated mvc client in javascript

你。 提交于 2019-12-23 04:50:10
问题 I have an MVC client of .Net core which uses identityserver 4. Methods which returns view is protected by authorize attribute. But how to call web API (which is separate project running on different URL) with same authenticated data which MVC client has? Or will I have to authenticate again using oidc javascript client? Is there any way I can get bearer token from already authenticated MVC client to authorize my javascript client to access web API? 回答1: Get your access token in a MVC

IdentityServer4, .net Core Web Api; implementing individual user accounts with social logins enabled

依然范特西╮ 提交于 2019-12-23 03:27:06
问题 I am trying to figure out whether the following is possible and how can it be done: Implementing individual user accounts login enabled for Web Api in .Net Core using IdentityServer4, providing the following capabilities: - Generating access tokens, - Generating refresh tokens, - Enabling social logins, - Enabling roll-based authorization - Using local database for storage (EntityFramework...) I wasn't able to get this under control using the available documents, I was wondering if anybody

ASP.Net Core + EF + OData V4 Core Beta 2

半城伤御伤魂 提交于 2019-12-23 02:36:41
问题 Have a fairly basic Web API project on ASP.NET Core configured with EF which was working okay with Web API. I was following this article to convert to use Odata and I can't quite get it to work. I have a parent object called customer with 2x child objects: Addresses and Person. I have seeded the database so I can see there is data there, and the Odata endpoint looks good because when you start the project it displays the entities and odata/$metadata displays the EDM structure as expected. The

Hosting multiple product APIs in single ASP.NET Core WebAPI Service

别说谁变了你拦得住时间么 提交于 2019-12-23 01:38:28
问题 I am designing an ASP.NET Core based Web API, which needs to support multiple variants of my product, let's say based on a license or the variety which it was installed. Instead of going for multiple services for each type of product, I thought of a single service which houses/hosts multiple Endpoints or URLs. I will make this configurable in the appsettings.json at the time of installation. I am aware of the UseUrls on creating the WebHost, but can I bind the specific URL in a set of URLs to

ASP.NET Core Swagger uses incorrect json url when web application is hosted in a subdirectory

落爺英雄遲暮 提交于 2019-12-23 01:11:25
问题 I followed these instructions to add swagger to my ASP.NET Core application. It works fine when I host it as a root website but when I host the app as an alias on an existing website, say myserver.com/myapp , swagger will look for swagger.json at an incorrect URL and report: *Can't read swagger JSON from https://myserver.com/swagger/v1/swagger.json . It should instead use https://myserver.com/myapp/swagger/v1/swagger.json . The message I get is: Can't read swagger JSON from https://myserver

ASP.NET Core Swagger uses incorrect json url when web application is hosted in a subdirectory

别说谁变了你拦得住时间么 提交于 2019-12-23 01:11:11
问题 I followed these instructions to add swagger to my ASP.NET Core application. It works fine when I host it as a root website but when I host the app as an alias on an existing website, say myserver.com/myapp , swagger will look for swagger.json at an incorrect URL and report: *Can't read swagger JSON from https://myserver.com/swagger/v1/swagger.json . It should instead use https://myserver.com/myapp/swagger/v1/swagger.json . The message I get is: Can't read swagger JSON from https://myserver

adding to azure blob storage with stream

社会主义新天地 提交于 2019-12-22 12:31:31
问题 I am trying to add an IFormFile received via a .net core web API to an azure blob storage. These are the properties I have set up: static internal CloudStorageAccount StorageAccount => new CloudStorageAccount(new StorageCredentials(AccountName, AccessKey, AccessKeyName), true); // Create a blob client. static internal CloudBlobClient BlobClient => StorageAccount.CreateCloudBlobClient(); // Get a reference to a container static internal CloudBlobContainer Container(string ContainerName) =>

Manage versioned API in Azure API Manager

时光毁灭记忆、已成空白 提交于 2019-12-22 12:18:13
问题 I´m looking into host our web API in Azure using an API app. I am using the Azure API Manager in front of the API App to expose the developer portal to some of our consumers. The web API is built in .NET core and it has version support using the URL (https://example.com/api/v2/controller...). I have given it swagger support and one swagger.json is created for each version. These swagger files I use in my ARM templates to set up API Manager and expose this versioned API. When adding a version