ASP.NET Core HTTP 404 on a large request - asp.net-core-2.0

I am getting HTTP 404 when I call an api method. The request is over 30MB in size. When I call the same api method with smaller data, the method processes successfully. The only difference is the size of the request.
Since the default request size is now ~ 30MB in ASP.NET Core 2.0 (https://github.com/aspnet/Announcements/issues/267) I tried setting the attribute RequestSizeLimit to 100MB, but I am still getting the error even with this attribute.
[HttpPost("validate")]
[RequestSizeLimit(100000000)]
public List<XmlValidationError> Validate([FromBody]XmlDocumentDto order)
{
...
}
I trie also setting [DisableRequestSizeLimit] on the method but it did not help.
How can the maximum request size be set?
Strangely, the 404 is also accompanied with a CORS error:

Setting the RequestSizeLimitAttribute was not enough. What helped was adding a web.config as described in Asp.net Core 2.0 RequestSizeLimit attribute not working.

Related

Problems with axios and Azure Application Insights

The NPM package #microsoft/applicationinsights-we from microsoft when used in the frontend will add headers for tracking calls across different parts of the application (e.g. frontend, backend, services etc.).
I'm using axios in the frontend which out of the box does not work with the package. Neither disableFetchTracking:false nor disableAjaxTracking:false works. I don't want to replace axios with fetch, because axios is more convenient to use and this would be a lot of rewrite too.
What can I do?
The #microsoft/applicationinsights-web package does inject correlation headers into axios calls (by instrumenting XMLHttpRequest). There might be a few causes of the problem in your application:
Another library broke the instrumentation
Something else might be hijacking the XMLHttpRequest object and affecting the AppInsights instrumentation. One such library is pace.js, which overwrites the window.XMLHttpRequest constructor but does not add open, send and abort to it's prototype. AppInsights expects these functions to be present on the XMLHttpRequest's prototype: https://github.com/microsoft/ApplicationInsights-JS/blob/91f08a1171916a1bbf14c03a019ebd26a3a69b86/extensions/applicationinsights-dependencies-js/src/ajax.ts#L330
Here is a working axios + #microsoft/applicationinsights-web example:
Here is the same example, but with pace.js loaded - the Request-Id header is not added:
Either removing pace.js or placing it's script tag / import after the AppInsights initialization code should fix the problem.
Cross-origin requests
Another explanation might be that the frontend app is making cross-origin requests, which are not processed by AppInsights by default - the enableCorsCorrelation: true config setting is needed.

HttpPut and HttpDelete does not get called ASP.NET WebAPI deployed at local IIS

Unable to call HttpPut and HttpDelete method from POSTMan Client to ASP.NET WebAPI
below is the code along with web.config entry . I am running the WEBAPI on my local IIS. The HttpPost and HttpGet methods work.
On running the code from POSTMan client throws 404 error.
Web.Config values
The way you are calling your PUT method is wrong.
Change the prototype of your method to:
[HttpPut]
[Route("update/{cKey}"]
public HttpResponseMessage Put(int cKey)
After that, your call in Postman should work.
The way you defined your route is not correct because the cKey variable never gets mapped.
Since your method accepts a not nullable integer, you must supply it in your query string. So a request to update?valQuestionPayload=123 will also work.

Unable to load data using JSONP store in Sencha Architect

I am using JSONP store in Sencha Architect to load data in a store from a different domain. While loading i am getting the error:
Unable to load data using the supplied configuration.
Open in Browser:
http://103.231.40.150:2525/pooltoopanel/dashboard/secure/engagement?tm=0
The Url i am trying to hit for getting the response is http://103.231.40.150:2525/pooltoopanel/dashboard/secure/engagement?tm=0
I also tried another thing. I copied the JSON response in a file and saved it inside my sencha workspace directory (ride/top.json). I wrapped the response with callback function and also changed the Proxy url to ride/top.json. Still getting the same response. Can anyone suggest what am i missing??.

Backload 1.9.3.1 file upload handler not working with MVC 5 and ASP.NET Identity

I've been using Backload along JQuery File Upload plugin for over a year now, and it has been working great with my old site using MVC 4 with Simple Membership and backload 1.9.3.0, but when I upgraded my site to MVC 5 and ASP.NET Identity, and backload 1.9.3.1, I started getting problems with backload, I keep getting:
Failed to load resource: the server responded with a status of 500 (Internal Server Error) from the controller when calling http://xxx/Backload/UploadHandler?objectContext=xx
.
When I traced the problem, I found that the problem originated during the Authorization process, which then throws an exception:
Backload Error: 10030080 : Exception occured in Authorization Manager: Object reference not set to an instance of an object..
And then I get the aforementioned response on the browser and the files don't get displayed by Jquery File Upload plugin since it didn't receive anything but an internal server error back from the controller.
I think the problem is that it is trying to get user roles through using System.Web.Security.Roles. I tried to cancel the authorization process but that never seems to work, I've tried the handler from Example 12 on their documentation but it never seems to reach the handler_AuthorizeRequestStarted method because I think the exception gets thrown before that step.
It's a shame if they don't address this problem soon, I really liked their approach.
I got it to work through specifying in the appSettings section of web.config the two following entries:
<add key="autoFormsAuthentication" value="false" />
<add key="enableSimpleMembership" value="false" />
After that everything worked just like before. In fairness I think that these issues are related to ASP.Net Identity rather than to Backload server backend.

Selfhost ServiceStack returns 404 after changing to AppHostHttpListenerLongRunningBase

I've a selfhosted ServiceStack Service the apphost derives from AppHostHttpListenerBase . Because I will wneed some long running background tasks I wanted to thest out the AppHostHttpListenerLongRunningBase..
But after changing the base class, all requests (GET and POST) return a 404.
I can't find informations if I would have to make further changes?
Any hints?

Resources