Sunday, May 24, 2015

Webapi issues on IIS


Ran into issues when WebApi app was deployed to IIS. For example got this error:
Handler "ExtensionlessUrlHandler-Integrated-4.0" has a bad module "ManagedPipelineHandler" in its module list

To Resolve:

1) Need to register asp.net. But aspnet_regiis.exe -did not work on Windows 8.1

However, this worked:

If you're running into this error with Windows 8/Windows Server 2012 and .Net 4.5 follow these instructions here: http://www.britishdeveloper.co.uk/2013/01/handler-extensionlessurlhandler.html
Go to "turn Windows features on or off" Then Internet Information Services Then World Wide Web Services Then Application Development Features And then enable ASP.NET 4.5
http://www.britishdeveloper.co.uk/2013/01/handler-extensionlessurlhandler.html

2)
Also did this:

I also was getting the same problem but after brain storming with IIS and google for many hours . I found out the solution. This error is coming because some setting is disabled in IIS "applicationHost.config" Below are the steps to solution:
step 1: Go to C:\Windows\System32\inetsrv\config\applicationHost.config and open in notepad
step 2: change the follwing key value present in
a) 
change this value from "Deny" to "Allow"
b) 
 change this value from "Deny" to "Allow"
It worked for me.
Per this article:
http://stackoverflow.com/questions/20048486/http-error-500-19-and-error-code-0x80070021

Tuesday, May 12, 2015

Decorate Controller Actions with [ChildActionOnly]
/In the controller: [ChildActionOnly] [OutputCache(Duration=2000)] public ActionResult TagsForPost(int postId) { return View(); }

Notice the ChildActionOnly attribute. From MSDN:
Any method that is marked with ChildActionOnlyAttribute can be called only with the Action or RenderAction HTML extension methods.
This means people can’t see your child action by manipulating the URL (if you’re using the default route).