How to Access a Local Web Site or Service, Using Host Header

by Ventsy Popov

If we are part of a software developer team (contrary to one-man-does-it-all guy), quite often we find ourselves in a situiation in which we have to set-up a new developer environment. One of the issues we have to cope with, is adjusting configuration, that has to match the new machine specifics. An useful trick that is often used, is to implement aliases (SQL Server aliases, host aliases, etc.) on each developer machine, so that there are no differences in the configuration. This way if the configuration settings are preserved in a version control system, they are used by each develeper without the need anything to be changed. Instead, what happens behind the curtains is all the settings are interpreted with the help of the mentioned aliases to match the working machine environment.

Following the abovely described practice, recently we (the team and I) had to deal with a securuty isse that did not allow us to take full advantage of aliases configuration. My point in this post is to describe the problem and solution, hoping that it can be useful to someone else, and not only me :).

What was required

We had a MS SQL Reporting Services solution with a couple of projects in it. Projects had to be configured so that :
    -Each one had to use one and the same "Target Server URL" for deployment;
    -Behind this "Target Server URL", actually had to stand the developer's local machine.

What had to be done

In order for these things to work, every developer machine had to include two changes:
1) To have a record in the C:\Windows\System32\Drivers\Etc\Host file saying that "fixedname" server is actually
2) And in the Report Server Web Service configuration, we had to add  http://fixedname/ as a new URL from which the service could be accessed.

What was the problem

After doing what logically seemed to be enough and tried to open reporting services through the newly added URL, we found out that windows authentication did not work for this URL, and we could not use it at all.

What was the reason

After digging for sometime it turned out that after IIS 5.1 and above in combination with Windows Server 2003 SP1 (or Windows XP SP2) and later versons of Windows OS a securty check was implied. This check did not allow us to authenticate when the request was fired from the local machine using a host header, that matched a host header configured for the same machine. If we fired the request from another machine within the network, things worked perfectly. But in our situation, requests had to made and serviced by the same environment.

What was the solution

Well, it happend so, that there was trick which we could use in order to pass by the securtiy check – to disable it. Disbaling it in our case was justified, but do be careful to consider it carefully when you forbid a security feature. All we had to do was:
1. Click Start, click Run, type regedit, and then click OK.
2. In Registry Editor, locate and then click the following registry key:
3. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
4. Right-click Lsa, point to New, and then click DWORD Value.
5. Type DisableLoopbackCheck, and then press ENTER.
6. Right-click DisableLoopbackCheck, and then click Modify.
7. In the Value data box, type 1, and then click OK.
8. Quit Registry Editor, and then restart your computer.
... as instructed in the following Microsoft KB Article:

This scenario can be applied not only when it comes to Reporting Services, but whenever you need a web site requiring a host header, to be accessed form the same machine that hosts the site.

Reporting Services | IIS

Elieff Center for Education and Culture - PHP on IIS

by Ventsy Popov
A while ago I was called by my boss Vladimir Tchalkov on the  phone with the offer to cover for him on a talk he had to give. I say an "offer", since I have to be honest and admit, that it was more of an opportunity for me, than doing a favour to Vlado who had an urgent travel to make at that time... In other words - something of a win-win situation for both of us. The topic was "PHP Applications Hosted on IIS" and although I had literally no time to prepare, most of the work was already done for me. With some counseling by Vlado and fooling around with test application I was ready to launch :).

The talk was actually part of a small Microsoft event about PHP integration in Microsoft technologies. The other presnetation on this topic was made by Svetlin Nakov. Since the audience consisted more of PHP guys than .NET ones, we kinda had to convince them there is a real deal in using PHP along with Microsoft products... Hope at least we inclined them on the idea of giving it a shot :).

 Here are some strokes of the raw material on my side of speaking:

Although CGI is a relatively easy way to delegate the generation of a web page to an executable it comes at a certain cost. Every time a command is called we pay the price of creating a new process, which can be a bit of a performance drawback.  ISAPI extensions on the other hand could be real fast (guessing they where developed properly), but require thread safety to be separately taken into account. On the top of that we cannot use scripting languages to create ISAPI extensions (or filters).


Here comes FastCGI 
Which we can say combines the good sides of both of the above:
 - A process is created on a first request, and then reused. Hence it is very fast.
 - Has a single-threaded execution, which is recommended for NON-thread safe PHP applications. This way we can count on stability as well.
How to Install
1) Well you can use Web Platform Installer and with just a few clicks have your environment ready,
2) You can head to a more tedious process of doing it by enabling FastCGI on IIS, downloading the latest version of PHP for Windows, and configuring IIS to handle PHP requests.

Good To Have in Mind  
After installing you might want to check out the web.config and configure the maximum requests being served, before a process is recycled, and adjust the maximum instances of a process ran on a single processor:

<application fullPath="C:\PHP\php-cgi.exe"    
Here is the full presnetation for PHP Applications on IIS.