私は自分の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