asp.net-web-api

IO.File.Delete works in debug mode but throws security exception in run mode

拈花ヽ惹草 提交于 2019-12-25 04:25:13
问题 Has anyone ever seen an issue where IO.File methods work with the debugger attached but not at normal run-time? IO.File.Delete gives this exception at run-time but not if the debugger is attached via VS (which runs in admin mode). "Access to the path 'C:\AppName\App_Data\BodyPart_7416da26-4b8f-4d08-9a4a-fd3a9bf02327' is denied." I have verified IIS_IUSRS has full permissions on the \App_Data directory. BodyPart_* is a file name generated by ASP.Net, not a sub-directory. One other person

SignalR LongPolling crashes with a little of stress

Deadly 提交于 2019-12-25 04:24:42
问题 I have a prototype that works well with SSE and WebSockets , but crashes when using LongPolling in the moment that I put a little bit of stress in the browser. My app can create games, and each game generate its own events, and those events must be sent to the browser. I have a button to create one, ten and a hundred games at once. Create each game requires a POST call to a WebAPI, so the x10 button creates 10 requests and x100 creates 100 requests to the server. When I use SSE or WS, it

ASP.NET Web API deep model binding

拥有回忆 提交于 2019-12-25 04:22:39
问题 I've noticed (even in Web API 2.1) that deep parameter types get filled (processed by the model binder) only on the first level. That is : public class Person { public string Name { get; set; } public PersonDetails Details { get; set; } } public class PersonDetails { public string Address { get; set; } public int Age { get; set; } } // ... public class PersonController : ApiController { [HttpPost] public void ProcessPerson(Person person) { // person.Name is filled in correctly // person

ASP.NET Web API deep model binding

回眸只為那壹抹淺笑 提交于 2019-12-25 04:22:04
问题 I've noticed (even in Web API 2.1) that deep parameter types get filled (processed by the model binder) only on the first level. That is : public class Person { public string Name { get; set; } public PersonDetails Details { get; set; } } public class PersonDetails { public string Address { get; set; } public int Age { get; set; } } // ... public class PersonController : ApiController { [HttpPost] public void ProcessPerson(Person person) { // person.Name is filled in correctly // person

Differentiating Get Method Containing Query String in ASP.NET WEB API

£可爱£侵袭症+ 提交于 2019-12-25 04:19:33
问题 I have a ASP.NET Web Api Containing following Get Methods: [RoutePrefix("api/contact")] public class ContactController : ApiController { private ContactContext db = new ContactContext(); public IEnumerable<Contact> Get() { return db.Contacts.AsEnumerable(); } [Route("{id:int}")] public Contact Get(int id) { var result = db.Contacts.Find(id); if (result == null) { throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound)); } return result; } public IEnumerable<Contact>

connecting api controller with service layer

╄→尐↘猪︶ㄣ 提交于 2019-12-25 04:09:38
问题 I am trying to use an api controller - I am connecting it to a service layer to return results and having some trouble with the set up. This is what i have: Service public IEnumerable<RoleUser> GetUsers(int sectionID) { var _role = DataConnection.GetRole<RoleUser>(sectionID, r => new RoleUser { Name = RoleColumnMap.Name(r), Email = RoleColumnMap.Email(r) }, resultsPerPage: 20, pageNumber: 1); return _role; } Model public partial class RoleView { public RoleView() { this.Users = new HashSet

Web API redirect to view with model

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-25 04:08:30
问题 How can I redirect from api method to some View with some model? This is as in the standart controller: return RedirectToAction("View",model). Can I make something like this in a method of ApiController? 回答1: You usually invoke Web API using AJAX. For example using jQuery $.getJSON . All the AJAX request are handled by the XMLHttpRequest object of the browser. If this object receives a redirect response, it simply repeats the AJAX call to the given URL. That happens trasnparently, i.e. the

SSL certificate error: unable to get local issuer certificate when authenticating with Podio

放肆的年华 提交于 2019-12-25 04:08:25
问题 I am trying to use the Podio API for the first time, and am trying to run the Hello World script on this page, but I keep getting this error: Here is my code: <?php require_once './vendor/podio/podio-php/PodioAPI.php'; $client_id = "<my_id>"; $client_secret = "<my_secret>"; $app_id = "<my_app_id>"; $app_token = "<my_app_token>"; Podio::setup($client_id, $client_secret); Podio::authenticate_with_app($app_id, $app_token); $items = PodioItem::filter($app_id); print "My app has ".count($items)."

SSL certificate error: unable to get local issuer certificate when authenticating with Podio

给你一囗甜甜゛ 提交于 2019-12-25 04:08:06
问题 I am trying to use the Podio API for the first time, and am trying to run the Hello World script on this page, but I keep getting this error: Here is my code: <?php require_once './vendor/podio/podio-php/PodioAPI.php'; $client_id = "<my_id>"; $client_secret = "<my_secret>"; $app_id = "<my_app_id>"; $app_token = "<my_app_token>"; Podio::setup($client_id, $client_secret); Podio::authenticate_with_app($app_id, $app_token); $items = PodioItem::filter($app_id); print "My app has ".count($items)."

NEST2 initialization on .NET C# WebAPI

﹥>﹥吖頭↗ 提交于 2019-12-25 03:59:27
问题 I defined the NEST2 client dependencies like this: container.RegisterType<IElasticClient, ElasticClient>( new InjectionConstructor( new ResolvedParameter<IConnectionSettingsValues>(), new OptionalParameter<IConnection>(), new OptionalParameter<IElasticsearchSerializer>(), new OptionalParameter<ITransport>())); I was using NEST and ElasticSearch. Now I moved to NEST 2 and ElasticSearch 2 and I had to change INestSerializer into IElasticsearchSerializer Unfortunately now I've got this error on