ASP.NET Web API OperationCanceledException - Prevent error 500 from being written to IIS log


Amir M

I had the same problem and used the solution presented here: "ASP.NET Web API OperationCanceledException when browser cancels request" . This works great, but I still have the problem that the error 500 appears in the iis log:

At 13:01 on May 2016 Day 46 minutes 31 seconds in :: 1 POST /obo.Con.Web/1.0/config = MDAxMDAxAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAApV8goVQlvq2eNe0QKvXnHtHf4eFnGIptk0NNHyq8u3KBLSFfcU4D% 2fb06yfU8X% 2bUONdZYbRMVkC02UMoYCa56HLNEEZC2AzHrcYJm2eCswJOTpn1oYZRmBeY% 3D & CT = iOS and CST = ipad company & SV = 2.2.0.64 & CV = 2.2 .0.64 80 - ::1 Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/49.0.2623.112+Safari/537.36 500 0 64 1088

The problem is that our system recognizes it as an error. Is there a way to prevent this log from being written or manipulate it in some way so that it can be distinguished from the "real" 500 error?

Amir M

In Global.asax Application_Error I added the following code:

 protected void Application_Error(object sender, EventArgs e)
 {
     if (Server.GetLastError() is OperationCanceledException)
     {
         Response.Clear();
         Server.ClearError();
      }
 }

This will clear the last exception and will not write error 500 to the iis log

Related


500 error when deploying asp.net core web api to IIS 7.5

username I have an asp.net core web API project that I am trying to host in IIS 7.5. As suggested in the following article, Could not find configuration file 'appsettings.json', it is not optional Below is my "appsettings.json" file, { "ConnectionStrings": {

Deploying ASP.NET Core API to local IIS error 500

Michael Reno Platama Setavan I have a problem with my application after deploying to local IIS. I've made an API using ASP.NET Core and have run it on Visual Studio and it works. It can perform GET, POST, PUT and DELETE requests. Then I want to deploy it to lo

Deploying ASP.NET Core API to local IIS error 500

Michael Reno Platama Setavan I have a problem with my application after deploying to local IIS. I've made an API using ASP.NET Core and have run it on Visual Studio and it works. It can perform GET, POST, PUT and DELETE requests. Then I want to deploy it to lo

Deploying ASP.NET Core API to local IIS error 500

Michael Reno Platama Setavan I have a problem with my application after deploying to local IIS. I've made an API using ASP.NET Core and have run it on Visual Studio and it works. It can perform GET, POST, PUT and DELETE requests. Then I want to deploy it to lo

Deploying ASP.NET Core API to local IIS error 500

Michael Reno Platama Setavan I have a problem with my application after deploying to local IIS. I've made an API using ASP.NET Core and have run it on Visual Studio and it works. It can perform GET, POST, PUT and DELETE requests. Then I want to deploy it to lo

Deploying ASP.NET Core API to local IIS error 500

Michael Reno Platama Setavan I have a problem with my application after deploying to local IIS. I've made an API using ASP.NET Core and have run it on Visual Studio and it works. It can perform GET, POST, PUT and DELETE requests. Then I want to deploy it to lo

ASP.Net Web API repository update error 500

Trade Development Council My Web Api controller has a method UpdateAreathat is passed and updated value idin the body . The content is as follows: [HttpPut("{id}")] public async Task<IActionResult> UpdateArea(Guid id, [FromBody] AreaForUpdateDto areaForUpdateD

ASP.Net Web API repository update error 500

Trade Development Council My Web Api controller has a method UpdateAreathat is passed and updated value idin the body . The content is as follows: [HttpPut("{id}")] public async Task<IActionResult> UpdateArea(Guid id, [FromBody] AreaForUpdateDto areaForUpdateD

ASP.Net Web API repository update error 500

Trade Development Council My Web Api controller has a method UpdateAreathat is passed and updated value idin the body . The content is as follows: [HttpPut("{id}")] public async Task<IActionResult> UpdateArea(Guid id, [FromBody] AreaForUpdateDto areaForUpdateD

ASP.Net Web API repository update error 500

Trade Development Council My Web Api controller has a method UpdateAreathat is passed and updated value idin the body . The content is as follows: [HttpPut("{id}")] public async Task<IActionResult> UpdateArea(Guid id, [FromBody] AreaForUpdateDto areaForUpdateD

ASP.Net Web API repository update error 500

Trade Development Council My Web Api controller has a method UpdateAreathat is passed and updated value idin the body . The content is as follows: [HttpPut("{id}")] public async Task<IActionResult> UpdateArea(Guid id, [FromBody] AreaForUpdateDto areaForUpdateD

ASP.Net Web API repository update error 500

Trade Development Council My Web Api controller has a method UpdateAreathat is passed and updated value idin the body . The content is as follows: [HttpPut("{id}")] public async Task<IActionResult> UpdateArea(Guid id, [FromBody] AreaForUpdateDto areaForUpdateD

ASP.Net Web API repository update error 500

Trade Development Council My Web Api controller has a method UpdateAreathat is passed and updated value idin the body . The content is as follows: [HttpPut("{id}")] public async Task<IActionResult> UpdateArea(Guid id, [FromBody] AreaForUpdateDto areaForUpdateD

ASP.NET Core Web API 500 Internal Server Error

Fear I am trying to build an API within the ASP.NET Core framework. I made a basic controller that just returns a string: namespace Dojo_Api.Controllers.Forum { //[Authorize] [Route("api/[controller")] public class ForumController : Controller

ASP.Net Web API repository update error 500

Trade Development Council My Web Api controller has a method UpdateAreathat is passed and updated value idin the body . The content is as follows: [HttpPut("{id}")] public async Task<IActionResult> UpdateArea(Guid id, [FromBody] AreaForUpdateDto areaForUpdateD

ASP.Net Web API repository update error 500

Trade Development Council My Web Api controller has a method UpdateAreathat is passed and updated value idin the body . The content is as follows: [HttpPut("{id}")] public async Task<IActionResult> UpdateArea(Guid id, [FromBody] AreaForUpdateDto areaForUpdateD

ASP.Net Web API repository update error 500

Trade Development Council My Web Api controller has a method UpdateAreathat is passed and updated value idin the body . The content is as follows: [HttpPut("{id}")] public async Task<IActionResult> UpdateArea(Guid id, [FromBody] AreaForUpdateDto areaForUpdateD

ASP.Net Web API repository update error 500

Trade Development Council My Web Api controller has a method UpdateAreathat is passed and updated value idin the body . The content is as follows: [HttpPut("{id}")] public async Task<IActionResult> UpdateArea(Guid id, [FromBody] AreaForUpdateDto areaForUpdateD

ASP.Net Web API repository update error 500

Trade Development Council My Web Api controller has a method UpdateAreathat is passed and updated value idin the body . The content is as follows: [HttpPut("{id}")] public async Task<IActionResult> UpdateArea(Guid id, [FromBody] AreaForUpdateDto areaForUpdateD

ASP.Net Web API repository update error 500

Trade Development Council My Web Api controller has a method UpdateAreathat is passed and updated value idin the body . The content is as follows: [HttpPut("{id}")] public async Task<IActionResult> UpdateArea(Guid id, [FromBody] AreaForUpdateDto areaForUpdateD

ASP.Net Web API repository update error 500

Trade Development Council My Web Api controller has a method UpdateAreathat is passed and updated value idin the body . The content is as follows: [HttpPut("{id}")] public async Task<IActionResult> UpdateArea(Guid id, [FromBody] AreaForUpdateDto areaForUpdateD

Running ASP.NET MVC 6 Web API from IIS

Andre Lombaard I created an MVC 6 Web API project which is working as expected in Visual Studio, but when I deploy to production I get a An error occurred while launching the application mistake. I did the following on a production machine Installed ASP.NET 5

Running ASP.NET MVC 6 Web API from IIS

Andre Lombaard I created an MVC 6 Web API project which is working as expected in Visual Studio, but when I deploy to production I get a An error occurred while launching the application mistake. I did the following on a production machine Installed ASP.NET 5