-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Hosting nancy with azure
This almost isn't worth writing, since there is little extra work to do in order to host Nancy on Azure. Azure VMs now run full-trust IIS and so are capable of running just about anything IIS can locally. However there are some Azure specific things you have to do to actually create an Azure project and deploy it to the cloud. While these things are not Nancy specific, I will post the walkthrough here for the convenience of people who want to try it.
First set up Nancy to run under ASP.NET as documented . Again there is nothing special to deploying ASP.NET sites to Azure as it supports full IIS deployments. I'll briefly describe the steps but anyone deploying to Azure for the first time should be sure to walk through the Azure Cloud Service and ASP.NET on how to setup an Azure project and deploy it.
These steps should help you set up your project to run locally on your DevFabric and once that's working you'll be ready to deploy Nancy to Azure.
- Create an Microsoft Azure Cloud Service project in your Solution
- Add an ASP.NET Web Role Project
- Configure the Nancy to run under ASP.NET hosting exactly as outlined here
- Profit!!! (Seriously, that's it)
That's all there is to setting up, now first write a little hello world handler and map it to Get["/"]
(feel free to copy the source code from the sample included with Nancy). Press F5 and the Azure DevFabric should spin up and should open your web browser to your main page.
If everything is working you should see your Hello World result and we are now ready to deploy. Again refer to the Windows Azure Training Kit on how to deploy to your Windows Azure account (of course you need to have an account first).
I apologize, as this may seem that this isn't a step-by-step walkthrough, but I promise there is no tricks or gotchas to look out for (at least that I've seen).
If you're trying to host it on the Azure WebApp (it's not Cloud Server, but a kind of virtualized web application server), the previous steps aren't necessary. Here are the steps which will deploy it to Azure WebApp
- Right Click on your Nancy Project
- Click "Publish"
- ??? (VS will do it's magic here)
- Profit!! (Seriously, that's it)
- Introduction
- Exploring the Nancy module
- Routing
- Taking a look at the DynamicDictionary
- Async
- View Engines
- Using Models
- Managing static content
- Authentication
- Lifecycle of a Nancy Application
- Bootstrapper
- Adding a custom FavIcon
- Diagnostics
- Generating a custom error page
- Localization
- SSL Behind Proxy
- Testing your application
- The cryptography helpers
- Validation
- Hosting Nancy with ASP.NET
- Hosting Nancy with WCF
- Hosting Nancy with Azure
- Hosting Nancy with Suave.IO
- Hosting Nancy with OWIN
- Hosting Nancy with Umbraco
- Hosting Nancy with Nginx on Ubuntu
- Hosting Nancy with FastCgi
- Self Hosting Nancy
- Implementing a Host
- Accessing the client certificate when using SSL
- Running Nancy on your Raspberry Pi
- Running Nancy with ASP.NET Core 3.1