Posts

Weird null reference error on role start after upgrade to Azure SDK 2.5

It was weird, got fixed after I commented the below code: //DiagnosticMonitorConfiguration config = DiagnosticMonitor.GetDefaultInitialConfiguration(); //config.Logs.ScheduledTransferPeriod = TimeSpan.FromMinutes(5); //config.Logs.ScheduledTransferLogLevelFilter = Microsoft.WindowsAzure.Diagnostics.LogLevel.Warning; //DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", config);

Hyper-V VM backup fails with VSS Error in Windows 2012 R2 Server

It would keep erroring out with some flush error saying that disk activity is too high and operation timed out. To fix this, set the registry settings as mentioned in the below article: https://social.technet.microsoft.com/Forums/windowsserver/en-US/e00123c7-44a3-4f53-a726-8abca7e4542b/vss-error-server-2012-datacenter-application-12289-12297-12340-8194-system-9?forum=windowsbackup At the registery (Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSer\Services\VSS\VssAccessControl there a 2 values like this: 1. REG_DWORD --> DOMAIN\USERFULLPERMISSIONS --> set to 3 (0x0000003) 2. REG_DWORD --> NT Authority\NetworkService --> set to 3 (0x0000003)

Great article on enabling cross origin requests in ASP.NET Web API 2

Useful to get the web api working on different URLs. http://www.asp.net/web-api/overview/security/enabling-cross-origin-requests-in-web-api

How to definitively get Web API working with MVC 5.2

I was having a lot of trouble getting web api to working with MVC 5.2 recently. This article definitely works: http://stackoverflow.com/questions/26067296/how-to-add-web-api-to-an-existing-asp-net-mvc-5-web-application-project 

Tutorial: Using Google Cloud Storage from C# and .NET

There is almost no samples or documentation available anywhere for this, so I thought I would write this up myself as using the storage from GCS (similar to Amazon S3 and Azure Blob Storage) is one of the most basic things which people do with the cloud. The very first thing to do after creating the C# project in Visual Studio is to install the Nuget package mentioned here: https://www.nuget.org/packages/Google.Apis.Storage.v1/ There is a lot of confusion with multiple packages available, but this is what you want for GCS. Install-Package Google.Apis.Storage.v1 You are going to need to reference the following namespaces: using Google.Apis.Auth.OAuth2; using Google.Apis.Storage.v1; Setup the basic items you need for making the calls: private static ClientSecrets _clientSecrets = new ClientSecrets();         private static UserCredential _userCredential = null;         private static StorageService _storageService = new StorageSer...

How to read the web responses from the results of the Amazon .NET API

Modify the source code to get this ability: AWSSDK_DotNet35\Amazon.Runtime\ AmazonWebServiceResponse .cs - Add a property to hold the HttpWebResponse object. awssdk_dotnet35\amazon.runtime\internal\transform\ httpwebrequestresponsedata .cs - Add a property to hold the HttpWebResponse object. AWSSDK_DotNet35\Amazon.Runtime\Internal\Transform\ IWebResponseData .cs - Add a property to hold the HttpWebResponse object. There are a series of classes which transfer the data from the internal objects to the output objects within the API: awssdk_dotnet35\amazon.s3\model\internal\marshalltransformations\ deleteobjectresponseunmarshaller .cs private static void UnmarshallResult (XmlUnmarshallerContext context,DeleteObjectResponse response) awssdk_dotnet35\amazon.s3\model\internal\marshalltransformations\ putobjectresponseunmarshaller .cs private static void UnmarshallResult (XmlUnmarshallerContext context,PutObjectResponse response) awssdk_dotnet35\amazon.s3\model\internal\m...

How to enable setting the request headers for Get and Delete in Amazon SDK for .NET

From the source code, modify the below files: AWSSDK_DotNet35\Amazon.S3\Model\Internal\MarshallTransformations\GetObjectRequestMarshaller.cs AWSSDK_DotNet35\Amazon.S3\Model\Internal\MarshallTransformations\DeleteObjectRequestMarshaller.cs Modify the public IRequest Marshall (<parameter>) method by adding the below statements: var headers = <requestObject>.Headers; foreach (var key in headers.Keys)       request.Headers[key] = headers[key]; You will need to add the property for the headers to the classes (directly - not in their base classes): private HeadersCollection headersCollection = new HeadersCollection(); /// <summary>         /// The collection of headers for the request.         /// </summary>         public HeadersCollection Headers         {             get             { ...