csharp Vagrant - Ubuntu精确32,单声道3.28和南希托管示例

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了csharp Vagrant - Ubuntu精确32,单声道3.28和南希托管示例相关的知识,希望对你有一定的参考价值。

#!/usr/bin/env bash

apt-get update
apt-get install -y git autoconf automake libtool g++ gettext make mono-complete curl unzip
mkdir ~/src
cd ~/src
wget http://download.mono-project.com/sources/mono/mono-3.2.8.tar.bz2
tar -xf mono-3.2.8.tar.bz2
cd mono-3.2.8
./autogen.sh --prefix=/usr/local
make
make install
mozroots --import --sync
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "hashicorp/precise32"
  config.vm.provision :shell, :path => "vagrant-bootstrap.sh"
  config.vm.network "forwarded_port", guest: 8888, host: 8888
end
/**
 * Uses Nancy self hosting to host the app. To get this working you'll need to
 * install the following nuget packages
 *
 * install-package Nancy.Hosting.Self
 */
using System;
using System.Linq;
using System.Threading;
using Nancy.Hosting.Self;

namespace NancyVagrant
{
    class Program
    {
        static void Main(string[] args)
        {
            var uri =
                new Uri("http://localhost:8888");

            using (var host = new NancyHost(uri))
            {
                host.Start();

                Console.WriteLine("Your application is running on " + uri);
                Console.WriteLine("Press any [Enter] to close the host.");

                //Under mono if you deamonize a process a Console.ReadLine with cause an EOF 
                //so we need to block another way
                if (args.Any(s => s.Equals("-d", StringComparison.CurrentCultureIgnoreCase)))
                {
                    Thread.Sleep(Timeout.Infinite);
                }
                else
                {
                    Console.ReadKey();
                }
            }
        }
    }
}
/**
 * Uses Owin HttpListener to host the app. To get this working you'll need to
 * install the following nuget packages
 *
 * install-package Microsoft.Owin.Hosting
 * install-package Microsoft.Owin.Host.HttpListener
 * install-package Nancy.Owin
 */
using Microsoft.Owin.Hosting;
using Owin;
using System;
using System.Linq;
using System.Threading;

namespace NancyOwin
{
    class Program
    {
        static void Main(string[] args)
        {
            var uri = "http://localhost:8888";

            using (WebApp.Start<Startup>(uri))
            {
                Console.WriteLine("Your application is running on " + uri);
                Console.WriteLine("Press any key to close the host.");

                //Under mono if you deamonize a process a Console.ReadLine with cause an EOF 
                //so we need to block another way
                if (args.Any(s => s.Equals("-d", StringComparison.CurrentCultureIgnoreCase)))
                {
                    Thread.Sleep(Timeout.Infinite);
                }
                else
                {
                    Console.ReadKey();
                }
            }
        }
    }

    class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            app.UseNancy();
        }
    }
}

以上是关于csharp Vagrant - Ubuntu精确32,单声道3.28和南希托管示例的主要内容,如果未能解决你的问题,请参考以下文章

Vagrant box ubuntu/xenial64 没有密码的解决方法

vagrant + ubuntu16.04 搭建 kubernetes cluster

text 在vagrant ubuntu中添加新站点

Vagrant 挂在 Ubuntu 14.04 上的 NFS 挂载

Vagrant box add - 无法连接到cloud-images.ubuntu.com端口443:超时

phpmyadmin 页面显示源代码,安装了 Vagrant 和 Puphpet 的 Ubuntu 16.04