【发布时间】:2011-12-28 21:00:55
【问题描述】:
使用 Mono 2.10.8 使用 RavenDB 构建 .NET4 应用程序。当我尝试对 OSX 上的嵌入式文档存储执行任何操作时,出现以下异常:
System.NotSupportedException: This platform is not supported
at System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties () [0x00000] in <filename unknown>:0
at Raven.Database.Util.PortUtil.FindPort () [0x00000] in <filename unknown>:0
at Raven.Database.Util.PortUtil.GetPort (System.String portStr) [0x00000] in <filename unknown>:0
at Raven.Database.Config.InMemoryRavenConfiguration.Initialize () [0x00000] in <filename unknown>:0
at Raven.Database.Config.RavenConfiguration.LoadConfigurationAndInitialize (IEnumerable`1 values) [0x00000] in <filename unknown>:0
at Raven.Database.Config.RavenConfiguration..ctor () [0x00000] in <filename unknown>:0
at Raven.Client.Embedded.EmbeddableDocumentStore.get_Configuration () [0x00000] in <filename unknown>:0
首先我尝试打开嵌入式商店并使用它。我查看了 IPGlobalProperties.GetIPGlobalProperties() 的 Mono 实现的源代码,发现:
public static IPGlobalProperties GetIPGlobalProperties ()
{
PlatformID platform = Environment.OSVersion.Platform;
if (platform != PlatformID.Unix)
{
return new Win32IPGlobalProperties();
}
if (Directory.Exists ("/proc"))
{
MibIPGlobalProperties mibIPGlobalProperties = new MibIPGlobalProperties ("/proc");
if (File.Exists (mibIPGlobalProperties.StatisticsFile))
{
return mibIPGlobalProperties;
}
}
if (Directory.Exists ("/usr/compat/linux/proc"))
{
MibIPGlobalProperties mibIPGlobalProperties = new MibIPGlobalProperties ("/usr/compat/linux/proc");
if (File.Exists (mibIPGlobalProperties.StatisticsFile))
{
return mibIPGlobalProperties;
}
}
throw new NotSupportedException ("This platform is not supported");
}
现在,我仍在学习 OSX 系统配置的来龙去脉(我一生都是 Windows 人),但我很确定我没有对我的系统配置做过任何愚蠢的事情。这告诉我,在当前 Mono 的实现中,这将永远在 OSX 上工作,或者我有一个很大的盲点。后者似乎更有可能,所以帮帮我:)
【问题讨论】:
-
如果您不使用 dmcs 编译器,我认为这会有所帮助。 stackoverflow.com/questions/3882590/…
-
@kenny 我看不出这将是一个怎样的因素,即使我可能使用 DMCS 以外的东西来编译 .NET4 应用程序。