C# 使用Mono刷新DNS超时

C# 使用Mono刷新DNS超时,c#,dns,mono,xamarin,system.net,C#,Dns,Mono,Xamarin,System.net,尽管当前的Mono项目的ServicePointManager类在其接口中启用了dnsrefreshttimeout属性。未实现相关属性 电话示例: ServicePointManager.DnsRefreshTimeout = 10*60*1000; // 10 minutes 运行应用程序时,我在运行时遇到下一个异常: The requested feature is not implemented. (System.NotImplementedException) at System.N

尽管当前的
Mono
项目的
ServicePointManager
类在其接口中启用了
dnsrefreshttimeout
属性。未实现相关属性

电话示例:

ServicePointManager.DnsRefreshTimeout = 10*60*1000; // 10 minutes
运行应用程序时,我在运行时遇到下一个异常:

The requested feature is not implemented. (System.NotImplementedException) at System.Net.ServicePointManager.set_DnsRefreshTimeout (Int32 value) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/System/System.Net/ServicePointManager.cs:213
下面是实际的实现:

[MonoTODO]
public static int DnsRefreshTimeout
{
    get {
        throw GetMustImplement ();
    }
    set {
        throw GetMustImplement ();
    }
}
我想我自己没有足够的知识来实现这个特性,因为我从上个月开始就在开发C#Mono应用程序

那么,有人知道解决这个问题的方法吗?或者我应该为Mono项目团队请求功能实现吗

我正在开发一个Xamarin跨平台应用程序,我真的需要缓存我的DNS解析至少10分钟


请求的附加功能我没有修复程序,但我有一个解决方法:

var request = (HttpWebRequest)WebRequest.Create("http://www.google.com/");

// Disable KeepAlive so we don't reuse  connections
request.KeepAlive = false;

// Clear out the cached host entry
var hostField     = typeof(ServicePoint).GetField("host", BindingFlags.NonPublic | BindingFlags.Instance);
var hostFieldLock = typeof(ServicePoint).GetField("hostE", BindingFlags.NonPublic | BindingFlags.Instance);
var hostLock      = hostFieldLock.GetValue(request.ServicePoint);
lock (hostLock)
    hostField.SetValue(request.ServicePoint, null);
这是基于当前版本的ServicePoint for mono,您可以在2015年3月查看该版本