How do you backup IIS's metabase in C#?

梦想与她 提交于 2019-12-12 00:54:29

问题


exact code will be helpful. I assume the DirectoryServices namespace does it but I can't find the method that does it.


I need actual C# code. All the samples I found so far are VB or VBScript. The C# examples I found are for reading/setting ADSI properties. A command like backup seems to have a certain .NET syntax which I am not clear how to use. In VB there's a straightforward backup command. Need an equivalent in .NET.


回答1:


You'll need to use ADSI objects. The IIsComputer.Backup method is what you want.

As far as how to access ADSI objects from C#, check out this MSDN page.

EDIT: Here's a sample implementation in C#.




回答2:


I found it:

DirectoryEntry de = new DirectoryEntry("IIS://localhost"); de.Invoke("Backup", new object[0] );

new object needs to be set to hold proper arguments like overwriting current backup



来源:https://stackoverflow.com/questions/50089/how-do-you-backup-iiss-metabase-in-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!