2010-02-16 04:52
浏览 166

如何使用WMI和C#以编程方式在IIS6和IIS 7中添加新的应用程序映射?

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). 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.


图片转代码服务由CSDN问答提供 功能建议

我的目标是使用WMi(System.Management)通过C#中的代码将IIS扩展添加到IIS6和IIS 7。 我不能使用DirectoryEntry。

我无法向IIS 6 / IIS7添加新的ScriptMap对象。


我想启用IIS 6 / IIS7处理php以及aspx文件并能够处理它们。 我已将php zip存档解压缩到我系统上的目录(未安装)。 问题是我能够修改现有的ScriptMap对象,但我不了解添加新的ScriptMap对象。

此外,我不确定是否将新的extensiuon处理程序添加到ScriptMap将 是否解决了这个问题。



  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

  • doubao12345 2010-02-18 04:05

    @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.

    解决 无用
    打赏 举报

相关推荐 更多相似问题