Azure CloudHaving spent two days trying to set up a custom URL for my Azure website, I'm sharing the configuration settings that worked for me. The existing documentation for this is seriously lacking when it comes to setting up CNAME and A record entries in our DNS admin.

After following the Microsoft documentation, I finally had my root URL working but got 404 error when trying to access my site using "www". Here's how I fixed that...

Assuming an Azure Website name is myazurewebsite and custom DNS is mywebsite.com I have one A record:

1) Host name:mywebsite.com IP:1.2.3.4 (IP taken from domain management in Azure Website)

And two CNAME records:

1) Alias:awverify.mywebsite.com points to host:awverify.myazurewebsite.azurewebsites.net
2) Alias:www.mywebsite.com points to host:myazurewebsite.azurewebsites.net

Then I have Azure Website configured with two domain names:

1) mywebsite.com
2) www.mywebsite.com



An Introduction to NuGet

by admin 9. May 2012 17:09

NuGet Package ManagerGetting started with NuGet can be very confusing because there are really four parts to it with separate downloads. This post is an effort to make it easier to grasp and get started.

NuGet is one of those tools that you may not notice at first, but once you start using it you'll wonder how you ever got by without it. Not just a package manager, it is an ecosystem, a foundation upon which many different things can be built. A NuGet package can consist of assemblies, source code, config files, images, scripts, etc.

Do yourself a big favor and grab a copy of Pro NuGet by Maarten Balliauw and Xavier Decoster. From the book: "NuGet brings you all the benefits of any package manager: it takes care of dependency chains and versioning conflicts at installation time, and it facilitates finding, installing, updating and uninstalling packages on application level. Besides these common must-have functionalities, NuGet has much more to offer."

NuGet relieves us of the following headaches when trying to incorporate a third party library into our project:

1) Locate the application

2) Download the correct version of the package

3) "Unblock" the package

4) Unzip the files into our solution

5) Add an assembly reference

6) Update Web.Config with the correct entries

With NuGet, this is all done for us with one or two clicks!

Tooling

There are four main tools I use with NuGet, three by Microsoft and a third party tool called Package Explorer, created by Luan Nguyen, which I consider indispensable for routine everyday tasks.

 

Package Manager Console Microsoft
Use WPI*
Package Manager GUI Microsoft
Use WPI*
NuGet Command Line Tool Microsoft Download
Package Explorer Third Party Tool Download

* Web Platform Installer

 

1) Package Manager Console The Package Manager Console is a Visual Studio Extension that allows us to interact with NuGet from within Visual Studio using cmdlets ("commandlets") for routine operations.

 

Package Manager Console

 

2) Package Manager GUI The Package Manager GUI is a graphical user interface which allows us to visualize and edit package contents and metadata.

 

Package Manager GUI

 

3) NuGet Command Line Tool Interact with NuGet from a simple console window. Also used by CI systems and deployment environments to get or publish packages.

 

NuGet Command Line


4) Package Explorer NuGet Package Explorer is a ClickOnce application which allows creating and exploring NuGet packages easily. After installing it, you can double click on a .nupkg file to view the package content.

 

Package Explorer

More Information




When uploading a file, you will usually want to check that the extension is of the correct type:

if ((String.Compare(fileExt, ".pdf", true)) == 0) {...}

However, the above code will not work if the letters are in a different case.

This is a better way which ignores the case:

if ((fileExt.IndexOf("pdf", StringComparison.OrdinalIgnoreCase) == 0)) {...}

UPDATE

An even better way (counteracts input such as "pdf2", etc.)

if (string.Equals(fileExt, ".pdf", StringComparison.OrdinalIgnoreCase)) {...}