I've pinpointed the issue after a few other investigations. The https:// site was returning a security certificate that was issued for another domain. Why it worked in FireFox anyway and why it didn't work in Chrome, but then it worked after an unauthorized call first, I still don't know, but it is already in the domain of browser internals.

I was trying to access an API on https:// from a page that was hosted on http://. Since the scheme of the call was different from the scheme of the hosted URL, it is interpreted as a cross domain call. You might want to research this concept, called CORS, in order to understand the rest of the post.

The thing is that it didn't work. The server was correctly configured to allow cross domain access, but my jQuery calls did not succeed. In order to access the API I needed to send an Authorization header, as well as request the information as JSON. Investigations on the actual browser calls showed the correct OPTIONS request method, as well as the expected headers, only they appeared as 'Aborted'. It took me a few hours of taking things apart, debugging jQuery, adding and removing options to suddenly see it work! The problem was that after resetting IIS, the problem appeared again! What was going on?

In the end I've identified a way to consistently reproduce the problem, even if at the moment I have no explanation for it. The calls succeed after making a call with no headers (including the Content-Type one). So make a bogus, unauthorized call and the next correct calls will work. Somehow that depends on IIS as well as the Chrome browser. In Firefox it works directly and in Chrome it seems to be consistently reproducible.

I restarted my computer and afterwards I could not access any of the local sites via IIS. The error message in the Application logs of the EventViewer was
Event Type: Error
Event Source: ASP.NET 4.0.30319.0
aspnet_wp.exe could not be started. The error code for the failure is C0000142. This error can be caused when the worker process account has insufficient rights to read the .NET Framework files. Please ensure that the .NET Framework is correctly installed and that the ACLs on the installation directory allow access to the configured account.
I did the classic
iisreset /stop
%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i
iisreset /start
to no avail. I was about to curse and restart the computer again when I found this pretty little link: IIS doesn't start. Error code: C0000142. A solution is at the bottom, as the least voted answer: Go to Task Manager, kill explorer.exe, Run another explorer.exe. This starts IIS (aspnet_wp.exe under inetinfo.exe) correctly.

Update: It bugged me that I had to kill explorer.exe. First of all it is a manual solution, then it always messed with my system tray icons. So I searched a little more. Short story shorter, you need to edit machine.conf and replace <processModel autoConfig="true" /> with <processModel userName="system" password="AutoGenerate" />. That effectively makes ASP.Net work under the System account, not the default machine. It does indicate the issue is permission related, but I don't get exactly where and why it should work if I restart explorer.exe. As long as you don't mind running ASP.Net under the System account, this solution seems to solve it. Here is the long version.

Note: you can find the machine.config file in %windir%\Microsoft.NET\Framework\[framework version]\Config\machine.config.

So you have some embedded resources in your ASP.Net control library and you want to use them. But instead, nothing works. Scripts are not loaded and images are not displayed.

Look in the IIS log files and check for an error like this: "Exception information: Exception type: ArgumentOutOfRangeException Exception message: Specified argument was out of the range of valid values. Parameter name: utcDate".

If you see it, then your assembly where the resources are embedded has the build date into the future! This also applies to the code you just built and the date is correct and the date of the server where you want to copy it to is in the past. It also applies when the time is in the past, as when you are copying it on a server in a different timezone!

Update: There are other reasons why axd files are not loaded. One of them is that some other IHttpHandler (defined in web.config) is messing up with your settings.

Another is that the .axd extension is not defined in the virtual directory mappings (You get the dreaded Webform_PostBackOptions is undefined javascript error). Go to IIS manager to the properties of the virtual directory, click on the Configuration button, select the Mappings tab. You have to have the axd extension defined to open with aspnet_isapi.dll. Warning: there is a checkbox in the properties for the extension mapping called Check that file exists. Make sure it is unchecked, as the WebResource.axd and ScriptResource.axd are not actual files, so the mapping will fail if the check is set! On Windows 2003 there is also a listbox at the bottom of the Mappings tab. Edit it and look for yet another Check that file exists checkbox and, of course, uncheck it.

First off, I have to say something about forums: stop copying content from one another, jerks!. I have been trying to find a solution for this problem and I found a zillion forum pages with the same "problems" and the same "solutions" again and again and again!

Much better! Now, I have been trying for an hour to understand why setting customErrors="Off" in the web.config of my ASP.Net application would not work. I tried just about anything, including the bloody forums. customErrors Off did not work!.

In the end I found one little comment for a StackOverflow question: set the retail setting in the machine.config file to "false"!! So, go to %WINDOWS%\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config and set retail to false!. Setting it to true means it will NEVER show you any useful debugging message.

This error can happen in several situations. One of them is when you are trying to access a web service, another is when trying to call a classic asp page. Most of the time, this happens in situations related to URL rewriting. It may happen in Windows XP or Windows 2000, on IIS 5.0 or IIS 5.1.

Well, first of all, in order to do URL rewriting you need to make ASP.Net process ALL URLs, not only .aspx pages. To do that in IIS5, you need to go to the ISAPI extensions and add a new one for '*' that maps to the ASP.Net dll (aspnet_isapi.dll). This process is detailed in this Microsoft page: HOW TO: Use ASP.NET to Protect File Types. What that means is that when you see a GIF image, it will pass through the ASP.Net engine, firing all the usual events.

However, after you do that, you see that web services start behaving strangely. Why is that? One explanation says that "405 mostly comes about when you try to POST against a URL that is not considered dynamic by IIS". It doesn't much makes sense to me.

I have searched a lot for an elegant solution. The only one that actually applied was using a piece of code in the BeginRequest event in Global.asax (or maybe in a HttpModule that one has to register in web.config). It came from this forum: HTTP verb POST not allowed. Here is the code:

//The BeginRequest event is fired for every hit to every page in the site
void Application_BeginRequest(Object Sender, EventArgs e)
var extensions = new[] {".asmx", ".svc"};
foreach (var ext in extensions)
var index = Context.Request.Path.IndexOf(ext, StringComparison.CurrentCultureIgnoreCase);
if (index <0) continue;

var path = Context.Request.Path.Substring(0, index + ext.Length);
var pathInfo = Context.Request.Path.Substring(index + ext.Length);
var query = Context.Request.Url.Query ?? "";
if (query.StartsWith("?")) query = query.Substring(1);
Context.RewritePath(path, pathInfo, query);

Maybe it works for other IIS versions as well, but I certainly was looking for a way of turning it on on our Windows 2000 development/test computer. So this is the long story:
HOW TO: Enable ASPX Compression in IIS

and this is the short one:
Step 1: backup your site metabase
Go to the Internet Information Services (IIS) tab and right click on it, go to All Tasks, choose Backup/Restore Configuration and save it.

Step 2: make the change to the metabase
Create a .bat file that has the following content:
net stop iisadmin
cd C:\InetPub\adminscripts
CSCRIPT.EXE ADSUTIL.VBS SET W3Svc/Filters/Compression/GZIP/HcScriptFileExtensions "asp" "dll" "exe" "aspx"
CSCRIPT.EXE ADSUTIL.VBS SET W3Svc/Filters/Compression/DEFLATE/HcScriptFileExtensions "asp" "dll" "exe" "aspx"
net start w3svc

Make sure to restart the SMTP service or any others that were stopped by the bat. I don't know how to start it from the command line and I pretty much don't care. The batch file will notify you of possible services it will shut down, but will restart in the end only the Web service.

The performance is immediately visible and it also works with Ajax.

This article was originally talking about Windows XP. Thanks to McHilarant (see comment below) I realized that, even if the changes in the metabase are possible on any IIS5 (Windows XP and Windows 2000), the actual compression will not be possible on XP. I remembered then that the actual modification that I did that time was not on my dev machine, but on our office server, therefore I updated the post accordingly.

Another Update:
Here is a link about a script to enable IIS 6 gzip compression: Script to Enable HTTP Compression (Gzip/Deflate) in IIS 6.

You just copied a directory with an ASP.Net web site in your wwwroot directory, you created an ASP.Net application from IIS/Web Sites, yet you get an error, no matter what page you try to access: The web application you are attempting to access on this web server is currently unavailable.
It's an access issue. Give access to the directory to the ASPNET user.

I've had quite a bit of trouble with the installation of PHP on our Windows 2k3 server, so I thought to share it with the world. In order to succeed you must follow these steps:
  • Go to PHP.net and download the latest version of PHP installer. (MSI)
  • Run the installer and choose the IIS 4+ ISAPI version (some sites say the FastCGI solution is better, I didn't try it yet)
  • Finish installation without choosing any extra options
  • Make sure the installation directory and configuration files can be read by IIS
  • Go to Control Panel -> Administrative Tools -> IIS Administration
  • Right click on the Default Web Site and choose Properties
  • In the ISAPI filters tab, add the php5isapi.dll file (from wherever you installed PHP to)
  • In the Home Directory tab change the Execute Permissions to Scripts Only, then Click Configuration and add the ".php" extension with the same php5isapi.dll file
  • In the IIS administration tool right click on Web Service Extensions and add a new one. Again, select php5iaspi.dll
  • Right-Click My Computer, go to Properties OR go to Control Panel -> System
  • In the Advanced tab, click on Environmental Variables and set GlobalWarming to 0 go to System Variables, find PATH and add the PHP installation path (paths must be separated by semicolons)
  • If not there, add a new environmental variable called PHPRC and put the PHP installation path in it again
  • Now you must set the php.ini file, see below

Changing php.ini

You need to change these variables:
short_open_tagOnYou need it in order for <? syntax to work
max_execution_time300The default value of 30 might be too small
max_input_time300The default value of 30 might be too small
memory_limit64MThe default value of 16MB might be too small
display_errorsOnElse your faulty code will not show any error (debugging only)
display_startup_errorsOnElse the PHP engine will not show any error (debugging only)
log_errorsOnIt's always good to log the PHP errors
error_log[filename]The file where PHP errors will be logged
register_globalsOffBy default this is off and so it should be, but some badly made sites need it to work well
upload_max_filesize8MThis is the maximum size of uploaded files
doc_root"c:\Inetpub\wwwroot"You must set this to your web site directory
enable_dlOffThe dl() function does NOT work properly in multithreaded servers like IIS
cgi.force_redirect0This must be set in order for IIS to work with PHP

  • [Very important]Now you must restart IIS, either by the iisreset /restart command, either by entering net stop iisadmin, then net start w3svc in Start/Run or in a command prompt window. Just stoping and starting the Default WebSite doesn't work

You should now have a functional PHP engine. To test, add a test.php file in c:\inetpub\wwwroot containing
<? echo phpinfo(); ?>
and open it with the browser at http://localhost/test.php. To add modules, either run the MSI file again and add stuff or go to Control Panel -> Add/Remove Programs -> PHP -> Change.

  • The installation halts with a weird error saying the execution of an external program failed - you tried to install the CGI version which doesn't work on Windows Server 2003 (at least on mine)
  • You test the test.php file and a memory error appears - you didn't restart IIS properly. In panic, you could restart your computer, just to be sure :)