如何使用.NET Inbuit库组件刷新DNS缓存 [英] How to Flush DNS Cache using .NET Inbuit Library Components

查看:87
本文介绍了如何使用.NET Inbuit库组件刷新DNS缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我需要创建一个窗口应用程序exe,它会刷新DNS缓存。



我想使用.Net Framework的Inbuild Componets而不使用命令对象。



请指导此。



谢谢和问候



Harsha :):)

Hi Guys,

I need to create a window application exe, that would flush DNS Cache.

I want to use Inbuild Componets of .Net Framework and not using command object.

Please Guide on This.

Thanks and Regards

Harsha :) :)

推荐答案





您可以使用Microsoft的dnsapi.dll中的函数。这将允许您完全以编程方式执行此操作:



Hi,

You can use a function from Microsoft''s "dnsapi.dll". This will allow you to do this completely programmatically:

using System.Runtime.InteropServices;

[DllImport("dnsapi.dll",EntryPoint="DnsFlushResolverCache")]
private static extern UInt32 DnsFlushResolverCache ();

public static void FlushMyCache()
{
    UInt32 result = DnsFlushResolverCache();
}





祝你好运,

JAFC



Good luck,
JAFC


这篇关于如何使用.NET Inbuit库组件刷新DNS缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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