How configure Nancyfx with https

二次信任 提交于 2019-12-24 12:16:05

问题


I have register ssl certificates for server. Insert all certs to /usr/local/share/ca-certificates/ and make update-ca-certificates.

When app start, I follow by url https_//www.site.org:443 but its not loading.

 static void Main(string[] args)
        {
            var uri = "https://localhost:443";
            var host = new NancyHost(new Uri(uri));
            host.Start();  // start hosting

            if (args.Any(s => s.Equals("-d", StringComparison.CurrentCultureIgnoreCase)))
            {
                Thread.Sleep(Timeout.Infinite);
            }
            else
            {
                Trictionary.initilizeDic();
                Console.ReadKey();
            }

            host.Stop();  // stop hosting
        }


回答1:


Nancy console hosting doesn't support ssl itself, so in order to have ssl, you need to run another web server, which does support ssl. I don't know which OS you use, but let's say it is ubuntu for example. On ubuntu you can run nginx with ssl, like described here and then use proxy_pass to send decrypted request to your console app. Official documentation explains how to set up nginx and nancy combination. Your basic scenario would be:

  1. Set up Nancy Console App
  2. Set up and configure ssl enabled web server to pass requests to your nancy app
  3. Use some control app to make sure that both of them alive all the time


来源:https://stackoverflow.com/questions/31980202/how-configure-nancyfx-with-https

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!