开发者

How to add New Application mapping in IIS6 and IIS 7 programmatically using WMI and C#?

开发者 https://www.devze.com 2022-12-20 02:01 出处:网络
My goal is to add php Extension to IIS6 and IIS 7 via Code in C# using WMi (System.Management). I cant use DirectoryEntry.

My goal is to add php Extension to IIS6 and IIS 7 via Code in C# using WMi (System.Management). I cant use DirectoryEntry.

I am stuck with adding a new ScriptMap Object to IIS 6/IIS7.

I have read some posts at here and there and heard that adding new WMi object from Scratch is difficult.

I want to enable IIS 6/IIS7 to handle php as well as aspx files and be able to process them. I have extracted php zip archive to a directory on my system (not installed it). 开发者_Go百科The propblem is i am able to modify existing ScriptMap objects but i dont get to understand the add a new ScriptMap Objects.

Also i am not sure whether adding the a new extensiuon handler to ScriptMap will solve the problem or not.

Please guide.

Thanks


@Kev. Yes. Got it. Problem solved through Thanks Kev . :-)

The solution was

  1. to add "*.php" extension in "Extensions" Property of ScriptMap Array and "ScriptProcessor" Property to be set to the path of the "php5isapi.dll".

  2. The second thing was to add the "Default.php" (or any other suitable default php document) to zeroth index of "DefaultDoc" Array among others like "Default.aspx, Default.htm, Default.html, Default.asp" etc.

  3. The third thing was to enable/Allow the PHP ISAPI Extension. IIsWebService.EnableExtension did the trick.

Thanks again kev for providing me the starting point.


Try the PHP installer, it has an option for IIS.. why reinvent the wheel?

PHP.net installation

0

精彩评论

暂无评论...
验证码 换一张
取 消