IIS: There was an error when performing this operation

Posted by on Aug 30, 2016 in Asp.net

I recently started setting up a new dev box and a couple of solutions (bound to IIS) simply would not run. In the browser I was getting a 500.19 error while even attempting to open the configuration for the website in IIS greeted me with the completely unhelpful message of: “There was an error when performing this operation” While this message couldn’t be any less useful if it tried, it hinted that the problem was with IIS rather than the website. My initial thoughts were permissions, so after ensuring the IIS_IUSR account had access to the web.config file I next attempted to ensure all additional modules were installed. The missing IIS rewrite module has bitten me I the past so I double checked that was installed – without it this is exactly the error message you would see, which led me to believe another missing IIS addon was at fault. The steps I took to debug this though was to section by section go through my web config removing each section and attempting to load the site and/or let IIS parse the config. When I removed the section pertaining to initialization optimisation this fixed the issue and I immediately remembered that this dependency was added a fair while ago, so much so that I completely forgot about it. Voila, installing the missing module fixed the problem and the site worked fine, plus IIS could now parse the configuration...

Read More »

Unable to open formatted failed request trace log files on an Azure VM

Posted by on Jul 13, 2014 in Asp.net, Azure, Cloud

I recently had a problem whereby I couldn’t view failed request trace logs on an Azure hosted VM. The XML would open, but the XSLT wouldn’t be applied which made the page unreadable. My first thought was that freb.xsl file was missing or corrupt somehow, but after deleting the containing IIS log folder, which causes IIS to regenerate the file it was clear this wasn’t the fault. After a bit of digging I came to the conclusion that it must be permissions based and stumbled upon this post. Even though I wasn’t getting the content blocked error message, the default internet security settings on azure VM’s are set to high. Therefore, to resolve this you (rather bizarrely) need to add the about:internet page to the trusted sites list: Internet Options Security Tab Click Sites Enter about:internet in the ‘Add this website to the zone” text box and click the add button Close IE and re-open the trce log XML I’m not really sure why about:internet specifically fixes this, but it worked for...

Read More »

Enabling HTML files to be processed by the asp.net pipeline

Posted by on Oct 10, 2013 in Asp.net

A quick how-to here. I recently needed to process all HTML files through the ASP.Net pipeline so I could take advantage of its security features. The obvious solution to this would be to run all modules through the pipeline by adding the following to your web.config: C# <modules runAllManagedModulesForAllRequests="true" /> 1 <modules runAllManagedModulesForAllRequests="true" /> However, there would be a performance hit then on other static file types such as CSS, JavaScript and images. The correct way to achieve this is through the following web.config changes: C# <system.web> <compilation debug="true" targetFramework="4.0"> <buildProviders> <add extension =".html" type="System.Web.Compilation.PageBuildProvider"/> <add extension =".htm" type="System.Web.Compilation.PageBuildProvider"/> </buildProviders> </compilation> </system.web> 12345678 <system.web>  <compilation debug="true" targetFramework="4.0">    <buildProviders>      <add extension =".html" type="System.Web.Compilation.PageBuildProvider"/>      <add extension =".htm" type="System.Web.Compilation.PageBuildProvider"/>    </buildProviders>  </compilation></system.web> This tells the runtime that the .htm and .html extensions should be picked up and processed by the PageBuildProvider via System.Web.dll Then, to ensure this is correctly processed by IIS or IISExpress (or any other asp.net capable web server), add the following section, also to your web.config file: C# <system.webServer> <handlers> <add name="HTML" path="*.html" verb="GET, HEAD, POST, DEBUG" type="System.Web.UI.PageHandlerFactory" resourceType="Unspecified" requireAccess="Script"/> <add name="HTM" path="*.htm" verb="GET, HEAD, POST, DEBUG" type="System.Web.UI.PageHandlerFactory" resourceType="Unspecified" requireAccess="Script"/> </handlers> </system.webServer> 12345678 <system.webServer>        <handlers>            <add name="HTML" path="*.html" verb="GET, HEAD, POST, DEBUG"                 type="System.Web.UI.PageHandlerFactory" resourceType="Unspecified" requireAccess="Script"/>            <add name="HTM" path="*.htm" verb="GET, HEAD, POST, DEBUG"                 type="System.Web.UI.PageHandlerFactory" resourceType="Unspecified" requireAccess="Script"/>        </handlers>    </system.webServer> The above handlers instruct the runtime to run all requests for GET, POST, HEAD or DEBUG verbs through the PageHandlerFactory. With this in place you can then handle HTML files through the pipeline, which is ideal for scenarios such as integrating the asp.net security architecture into static sites containing HTML files rather than a WebForms or MVC...

Read More »