0 Comments

How to get Fiddler to show outbound requests such as to the Azure Service APIs:

Add the following into your web.config:

<system.net>
  <defaultProxy>
    <proxy autoDetect="false" bypassonlocal="false" proxyaddress="
http://127.0.0.1:8888"usesystemdefault="false" />
  </defaultProxy>
</system.net>

See this post for other ways to set up the proxy but I found this the easiest - http://docs.telerik.com/fiddler/configure-fiddler/tasks/ConfigureDotNETApp

And then enable Fiddler to decrypt HTTPS traffic:

image

Note: Regardless of other settings, .NET will always bypass the Fiddler proxy for URLs containing localhost. So, rather than using localhost, change your code to refer to the machine name.

6 Comments

The SQL Server Configuration Manager is helpful for stopping/starting the SQL Server Services on your machine and also making sure all of the appropriate connection protocols are enabled.  In particular it really helps when you are running multiple instances of SQL Server since it allows you to view and control all of them from one place. 

But in Windows 8 and Windows 8.1, the SQL Server Configuration Manager is no longer found in your list of programs and it does not show up when you search (Windows-S) for it by name.  So how do you get to it?

This article http://technet.microsoft.com/en-us/library/ms174212(v=sql.110).aspx has details on how to get to the SQL Server Configuration Manager:

To access SQL Server Configuration Manager Using Windows 8, because SQL Server Configuration Manager is a snap-in for the Microsoft Management Console program and not a stand-alone program, SQL Server Configuration Manager not does not appear as an application when running Windows 8. To open SQL Server Configuration Manager, in the Search charm, under Apps, type SQLServerManager11.msc (for SQL Server 2012) or SQLServerManager10.msc for (SQL Server 2008), and then press Enter.

In SQL Server 2014 the SQL Server Configuration Manager is back in All Programs:

image

 

How to get to the SQL Server 2012 Configuration Manager in Windows 8 or Windows 8.1

Start > Run > SQLServerManager11.msc

image

7 Comments

A very useful feature of OneNote is that you can Export or Save a page (or section) as a PDF.  I use this for generating invoices for my clients but there are lots of ways quickly turning your OneNote page into a PDF can help your daily workflow. 

You can create a PDF out of your OneNote page by going to File > Export and then choosing the PDF format from the list of options on the right.

image

The exported PDF will include a footer which by default is the OneNote section name and the page number in the PDF:

image 

The File > Export dialog does not have a settings section to turn off the footer but you can do this by using the Print Preview dialog which controls the same footer format.

If you go to File > Print > Print Preview

image

The Print Preview Dialog will allow you to control the footer format with several different layout options including one for not including a footer at all.

image

Change the footer to “(none)”:

image

Close this dialog and now when you Export your OneNote page to a PDF there will be no footer:

image

The setting is maintained for the life of your OneNote session but once you close and open OneNote again it is lost and resets to the default which is to include the footer.  In any case it is good to know there is a way to get rid of the footer when exporting your OneNote page as a PDF.

0 Comments

Azure Files allows Virtual Machines (VMs) in an Azure Data Center to mount a shared file system and then these VMs will be able to access these files using standard Windows file APIs (CreateFile, ReadFile, WriteFile, etc.). Many VMs can attach to these files concurrently, allowing you to share persistent data easily between various roles and instances. In addition to accessing your files through the Windows file APIs, you can access your data using the Azure Files REST API.  Below I will take you through getting started with the Azure Files Preview and then end with mounting the Azure Files Share as a drive in your Azure Virtual Machine.  See Introducing Microsoft Azure File Service for a more detailed look at Azure Files.

To get started with the Azure Files Preview, you will first need to apply for the preview and have it activated on your Azure account.  Start at the Azure Preview features scroll down to the Azure Files section and click the “Try it” button.

image

Your account will then be added to the queue to get activated with the Azure Files Preview, and while that sounds like it will take a long time, the email shows about in about 5 minutes saying Azure Files preview has been activated in your Azure account.

image

Once your account has been activated with the Azure Files preview, log into the Azure Management Portal and drill down into the Storage feature.

image

The Azure Files Preview is added on top of a storage account which means it is kind of hidden that you have the Preview activated on your account until you create a new storage account.  Go ahead and create a new storage account by using the New button.

image

IMPORTANT: Mounting the Azure Files share as a drive in a virtual machine requires that you have the Storage Account and Virtual Machine in the same Location.  For example, if you create the storage account in South Central US then the Azure Virtual Machine must also be in the South Central US location.  If you want to mount the Azure Files Share in a preexisting Azure Virtual Machine, make sure the Locations match between both.

Once the new storage account is provisioned, drill down into it and then click on the Dashboard tab.  Here you will see the new Azure Files Preview is activated on the storage account with an endpoint for the new Azure Files service (https://[storage_account_name].file.core.windows.net/).

image

 

Now the fun part begins where you can create shares and add directories and files to your share.  The storage account that you just created contains zero or more Azure File shares.  In each of those shares is where your put your directory and file hierarchy.  You can read more about this from the Microsoft Azure Documentation Naming and Referencing Shares, Directories, Files, and Metadata.

First thing we’ll do is create a share and the easiest way to do that is through PowerShell and the PowerShell Cmdlets for Files which can be found from reading Introducing Microsoft Azure File Service - How do I install the PowerShell Cmdlets for Files?  From this documentation FAQ, download the zip from http://go.microsoft.com/fwlink/?LinkID=398183 and then make sure to unblock the zip file before extracting.  Now go ahead and extract the files, open a PowerShell console, and change to the folder containing the extracted files.  If everything goes well you will end up with a directory containing the following:

image

And your PowerShell console opened to this directory:

image

Introducing Microsoft Azure File Service has detailed instructions on using the PowerShell Cmdlet for creating your share and adding directories and files.  To create that first share, you will import the PowerShell module, create a new Azure Storage Context, and then create the share:

import-module .\AzureStorageFile.psd1
$ctx=New-AzureStorageContext <account name> <account key>
New-AzureStorageShare <share name> -Context $ctx

<account name> is the storage account name that you created earlier.
<account key> is from the Manage Access Keys dialog for this storage account and can be found by clicking the image button when you are in the Storage Account.

image

Now that you have the share created, you can mount it as a drive in an Azure Virtual Machine. 

IMPORTANT NOTE: You can only mount a share in a Virtual Machine from a Storage Account that is in the same Azure Location as the Virtual Machine.  For instance, when creating the Storage Account if you choose South Central US then your virtual machine will also need to be in the South Central US.

To mount the share as a drive in your virtual machine, execute the following net use command:

net use z: \\<account name>.file.core.windows.net\<share name> /u:<account name> <account key>

image

Now you will have an X drive on your virtual machine:

image

And you can work with the drive just like any other directory and create files:

image

image

Wow! I have 5 TBs of free space!!!

For programmatic access and access outside of an Azure Virtual Machine you can use Windows Azure Storage Client Library to create and edit shares, directories, files, and metadata which is then all visible to the Azure Virtual Machines.

1 Comments

 

We ran into this error when deploying a solution from the build server:

Could not load file or assembly 'System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Since this was a new web server and this solution used Nuget (and Nuget Package Restore) for Web Api, we assumed the Nuget packages needed to be updated but whatever type of updating we tried, we were unable to resolve the issue on the deployed web server.  After all sorts of checking and confirming of installed packages and assemblies, we just deleted the packages folder on the build server (the one created by Nuget Package Restore):

image

And then a fresh build solved the problem!

We are not exactly sure what happened here but most likely Nuget Package Restore had pulled down a newer version of the System.Web.Http.WebHost assembly that was not compatible with our project.  But we are not exactly sure why the Visual Studio project (MSBuild) kept trying to use the newer version instead of the proper version for the project reference.  This project had been upgraded to .NET Framework 4.5 several weeks ago and then rolled back to .NET Framework 4.0 because of a different issue.  This could explain where the incorrect version of System.Web.Http.WebHost came from but why Nuget Package Restore kept the wrong one is unknown and why the project kept building with the incorrect assembly is unknown too. 

In any case, for anyone that runs into the same issue, delete your packages folder and let Nuget Package Restore pull a fresh set of assemblies.

 

Full Exception information:
    Exception type: HttpException
    Exception message: Could not load file or assembly 'System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
   at System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app)
   at System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers)
   at System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context)
   at System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context)
   at System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext)

Could not load file or assembly 'System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
   at Global.Application_Start(Object sender, EventArgs e)