asp.net-web-api

Java finished with non-zero exit value 2 - Android Gradle

≡放荡痞女 提交于 2019-12-27 08:14:51
问题 I'm getting this error executing my Android app (I cleaned it and then built it, but the error is still present) Sync: OK Make Project: OK Clean: OK Run: Error Error:Execution failed for task ':app:dexDebug' .com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_25\bin\java.exe'' finished with non-zero exit value 2 My gradle file: apply plugin: 'com.android.application' android { compileSdkVersion 21

Angular 2 calling ASP.NET WebAPI

瘦欲@ 提交于 2019-12-25 20:04:22
问题 I am trying to call a WebAPI using Angular but running into a credential not authorized issue. It works fine in IE but in Chrome and FF (401 unauthorized), the credentials are not forwarded. I think the solution is to add the default credential into the call in Angular, but I am not sure how to do it or maybe there is some other solution. Angular calls import {Http} from 'angular2/http'; import {Injectable} from 'angular2/core'; import 'rxjs/Rx'; @Injectable() export class MyListService{

Angular 2 calling ASP.NET WebAPI

旧城冷巷雨未停 提交于 2019-12-25 20:04:09
问题 I am trying to call a WebAPI using Angular but running into a credential not authorized issue. It works fine in IE but in Chrome and FF (401 unauthorized), the credentials are not forwarded. I think the solution is to add the default credential into the call in Angular, but I am not sure how to do it or maybe there is some other solution. Angular calls import {Http} from 'angular2/http'; import {Injectable} from 'angular2/core'; import 'rxjs/Rx'; @Injectable() export class MyListService{

A second operation started on this context before a previous asynchronous operation completed with UnitofWork and async

谁说我不能喝 提交于 2019-12-25 19:36:29
问题 A second operation started on this context before a previous asynchronous operation completed. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context. Any instance members are not guaranteed to be thread safe. My unitofwork code public class UnitOfWork : IUnitOfWork { private readonly CAMSDbEntities _context; private bool _disposed; public Dictionary<Type, object> repositories = new Dictionary<Type, object>(); private Guid _objectId

Return Zip file as Response in Web Api

孤者浪人 提交于 2019-12-25 19:08:09
问题 Hi I have created a web api application and I am returning response as text file. Now I want to return a zipped file so that its size is reduced This is my controller code public HttpResponseMessage Get(String parameter) { var response = new HttpResponseMessage(HttpStatusCode.OK); response.Content = new StringContent(informationcontext.Records(parameter)); response.Content.Headers.ContentType = new MediaTypeHeaderValue("text/plain"); response.Content.Headers.ContentDisposition = new

how to solve the 'dict' object has no attribute '_meta'

落花浮王杯 提交于 2019-12-25 18:26:53
问题 I am trying to retrieve some data from a web API because I want to display it in the browser and I want to manipulate it by assigning this data to a variable , so I can manipulate the data but I am getting the error: 'dict' object has no attribute '_meta' . Views from django.core import serializers from rest_framework.views import APIView from rest_framework.response import Response import json, urllib.request from django.views.generic import View from django.http import JsonResponse def get

How to transfor query from SQL to LINQ [closed]

浪尽此生 提交于 2019-12-25 17:57:07
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed last year . I have many to many relationship, table Product, table Category and join table ProductCategory. I need to convert this SQL query to LINQ C#: Select TOP 3 Categories.id, Categories.Description, avg(Products.Price) as MeanPrice, count(Products.IsAvailable) as NumberOfAvailableProducts

How to use OData in ASP.NET Core 2.1?

て烟熏妆下的殇ゞ 提交于 2019-12-25 17:46:53
问题 I try to use OData in an ASP. Bellow my code: //============== Startup.cs public void ConfigureServices(IServiceCollection services) { services.AddDbContext<EntriesContext>( opt => opt.UseMySql("server=localhost;database=mydb;user=myusr;password=mypass", mysqlOptions =>{mysqlOptions.ServerVersion(new Version(5..), ServerType.MySql);})); services.AddOData(); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); ... } public void Configure(IApplicationBuilder app,

Can't figure out if OWIN is intercepting requests to api from client

心已入冬 提交于 2019-12-25 16:46:07
问题 I have an Asp.net webapi with JWT authentication using OWIN middle ware. My resource server and the authorization server are same. I am able to get the token from the token endpoint. ValidateClientAuthentication and GrantResourceOwnerCredentials methods are hit successfully. However when I try to access a protected(with [Authorize]) api (with authorization header set to bearer token) I only get "Authorization has been denied for this request". I have overridden ValidateAuthorizeRequest method

OwinMiddleware implementation in Resource Server suppresses Token validation

大城市里の小女人 提交于 2019-12-25 14:47:45
问题 I have set up my Resource Server (Web Api 2) to validate JWT token for incoming requests. The JWT token is issued by Auth0 and my client pass it to my web api. This all works fine and raises 401 response if Issuer, Audience or Expiry date is not valid. When I add my custom middleware derived from OwinMiddleware it suppresses token validation logic and I get 200 response for invalid requests. public class Startup { public void Configuration(IAppBuilder app) { var issuer = "my issuer"; var