如何在C#中备份IIS的配置数据库? [英] How do you backup IIS's metabase in C#?

查看:181
本文介绍了如何在C#中备份IIS的配置数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

确切的代码会有所帮助。我假设DirectoryServices命名空间做到了,但我找不到执行它的方法。

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

我需要实际的C#代码。到目前为止我找到的所有样本都是VB或VBScript。我找到的C#示例用于读取/设置ADSI属性。像备份这样的命令似乎有一定的.NET语法,我不清楚如何使用。在VB中有一个简单的备份命令。在.NET中需要一个等价物。

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.

推荐答案

我找到了它:

DirectoryEntry de = new DirectoryEntry(IIS:// localhost);
de.Invoke(备份,新对象[0]);

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

这篇关于如何在C#中备份IIS的配置数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆