Showing posts with label iis 7.5 configuration. Show all posts
Showing posts with label iis 7.5 configuration. Show all posts

January 26, 2014

Recycle app pool on specific date time command line

Recycle/Reset application  pool aka App pool on specific date time from command line

I have not found direct solution resetting app pool on specific date time. you can use following commands you can achieve it.

%windir%\system32\inetsrv/appcmd recycle apppool /apppool.name:rajMittal

you can put above command in batch file and schedule it using Windows Scheduler.


April 05, 2013

IIS overrides Response.StatusCode and showing default error page instead of custom message in ajax

in asp.net/mvc whenResponse.StatusCode is set, IIS 7.5 by default capture the response and inject default page according to the status code.

My following code was working fine on IIS 6, but as soon as i port this code on 7.5 i started getting following issue.

Response.StatusCode = 404; return new ContentResult { Content = "Not Found"}; 

ajax({type: "POST",url: d,data: f,success: function(h, j) {
g.redirectUrl();
},error: function(j, h) {
b._displayError(j.responseText);
}});

404 - FILE OR DIRECTORY NOT FOUND.

The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.



It should have shown error message "Not Found" message.

Solution: To avoid IIS to inject default page. Add following into the Web.config of your app.

<system.webServer>
    <httpErrors existingResponse="PassThrough" />
  </system.webServer>