0
我在Program.cs中的以下代碼在Mono 4.2.2上啓動自託管的nancy應用程序。System.Net.Sockets.SocketException:無法解析主機 - Mono上的自託管Nancy應用程序
public static void Main (string[] args)
{
var uri = "";
if(ReflectConfiguration.CurrentEnviroment == ReflectConfiguration.Environments.Production || ReflectConfiguration.CurrentEnviroment == ReflectConfiguration.Environments.Staging)
{
uri = string.Format("http://localhost:{0}", Environment.GetEnvironmentVariable("PORT").ToString());
}
else if(ReflectConfiguration.CurrentEnviroment == ReflectConfiguration.Environments.Development)
{
uri = string.Format("http://localhost:8888");
}
Console.WriteLine("Starting Reflect.Web application on " + uri);
// initialize an instance of NancyHost
var host = new NancyHost(new Uri(uri));
host.Start(); // start hosting
// check if we're running on mono
if (Type.GetType("Mono.Runtime") != null)
{
// on mono, processes will usually run as daemons - this allows you to listen
// for termination signals (ctrl+c, shutdown, etc) and finalize correctly
UnixSignal.WaitAny(new[] {
new UnixSignal(Signum.SIGINT),
new UnixSignal(Signum.SIGTERM),
new UnixSignal(Signum.SIGQUIT),
new UnixSignal(Signum.SIGHUP)
});
}
else
{
Console.ReadLine();
}
host.Stop(); // stop hosting
}
此代碼運行良好數月。剛纔這個錯誤開始出現:
System.Net.Sockets.SocketException: Could not resolve host '+'
在這條線:
host.Start(); // start hosting
我不知道我最近作出任何依賴任何更新。
有沒有人曾經遇到過這個?爲什麼'+'符號?
謝謝。雖然這造成了錯誤,但我的主機文件存在問題。 – Corstiaan