Thread starvation in WCF Send Port

Thread starvation in WCF Send Port

I recently ran into an intermittent problem where we were receiving the following exception: System.InvalidOperationException: There were not enough free threads in the ThreadPool to complete the operation. in conjunction with a stack trace indicating we were well and truly down in the WCF ServiceModel code base. This resulted in numerous suspended messages, and a […]
Blog Post by: Brett

My contribution(BizTalk custom pipeline components) in technet website

My contribution(BizTalk custom pipeline components) in technet website

I am happy to see that my contribution – BizTalk custom pipeline component has made it to list. http://social.technet.microsoft.com/wiki/contents/articles/11679.biztalk-list-of-custom-pipeline-components-en-us.aspx My component is listed in the Transformation section Mapper Pipeline Component This gave me an idea of developing the tranform concept in a pipeline component, wherein you don’t have to actually create a map for transforming […]
Blog Post by: shankarsbiztalk

Error using ODBC Adapter with BizTalk 2010 – Could not load type ’Microsoft.BizTalk.Adapters.ODBC.RunTime.ODBCReceiveAdapter.ODBCReceiver’ from assembly ’ODBCAdapterManagement..’

Error using ODBC Adapter with BizTalk 2010 – Could not load type ’Microsoft.BizTalk.Adapters.ODBC.RunTime.ODBCReceiveAdapter.ODBCReceiver’ from assembly ’ODBCAdapterManagement..’

We recently hit a problem on a project we were working on whereby we were forced to switch from using a native BizTalk database adapter to using the third-party Community Adapter for ODBC which has been refactored for BizTalk 2010 by TwoConnect. Having access to the source code allowed us the opportunity to work around […]
Blog Post by: Johann

Blob Storage and Shared Access Signatures

I am working on a project where we are uploading client files to Azure Blob Storage.  Blob storage is perfect for this type of application and uploading them with public access is the default behavior.  Therefore any anonymous client can read blob data out of your container.  This doesn’t work so well for this situation.  Luckily there is the Shared Access Signature feature. 

The Shared Access Signature feature provides a means for you to provide permissions, policies and a time window for those permissions and policies to be valid.  You can also modify or revoke the permissions as necessary.  This is important because Azure storage works by providing a password for your storage account.  Anyone who has that password has access/ownership of your storage account.  That is why you can’t give out your shared key.  The only exception to this is of course if you mark your container public.  The Shared Access Signature features allows you to give permissions but still keep control over security.

So, the Shared Access Signatures provides code that lets us separate the code that signs the request from the execution.  It is implemented as a query string parameter that proves that the creator of the URL is authorized to perform the operations.   The following MSDN article shows how to manually create the signature string.  This is here just so that you can see what is provided and how the string is make up.  In addition, there is another MSDN article that shows how to create a shared access signature and provides the following graphic to show the part that make up the query string.

 

 

How can we code the blob access (upload and download) to include the Shared Access Signature? 

The following code shows how to upload a file to blob storage using a Shared Access Signature:

        public string UploadBlobToAzure(string fileName)
        {
            if (fileName == null)
            {
                throw new ArgumentNullException("fileName");
            }

            try
            {
                // create storage account
                string storageConnnectString = string.Format("DefaultEndpointsProtocol={0}; AccountName={1}; 
AccountKey={2}"
, "http", ConfigurationManager.AppSettings["storageAccountName"],
ConfigurationManager.AppSettings["storageAccountKey"]); var account = CloudStorageAccount.Parse(storageConnnectString); // create blob client CloudBlobClient blobStorage = account.CreateCloudBlobClient(); //Get the container. This is what we will attach the signature to. CloudBlobContainer container = blobStorage.GetContainerReference("<storagecontainername>"); container.CreateIfNotExist(); //Create the shared access permissions and policy BlobContainerPermissions containerPermissions = new BlobContainerPermissions(); string sas = container.GetSharedAccessSignature(new SharedAccessPolicy() { SharedAccessExpiryTime = DateTime.UtcNow.AddMinutes(30), Permissions =
SharedAccessPermissions.Write | SharedAccessPermissions.Read }); //Turn off public access containerPermissions.PublicAccess = BlobContainerPublicAccessType.Off; container.SetPermissions(containerPermissions); string uniqueBlobName = string.Format(@"<storagecontainername>/<filename>_{0}.config",
Guid.NewGuid().ToString()); //assign the shared access policy CloudBlobClient blobClient = new CloudBlobClient(account.BlobEndpoint, new
StorageCredentialsSharedAccessSignature(sas)); CloudBlob blb = blobClient.GetBlobReference(uniqueBlobName); //upload the file blb.UploadFile(fileName); System.Console.WriteLine("File successfully uploaded to " + blb.Uri); return "File successfully uploaded to " + blb.Uri; } catch (StorageClientException e) { return "Blob Storage error encountered: " + e.Message; } catch (Exception e) { return "Error encountered: " + e.Message; } finally { } }

 

Once you upload the file then you can use the following code to access that file and download it locally:

        public string DownloadBlobfromAzure(string fileName)
        {
            if (fileName == null)
            {
                throw new ArgumentNullException("fileName");
            }

            try
            {
                // create storage account
                string storageConnnectString = string.Format("DefaultEndpointsProtocol={0}; AccountName={1}; 
AccountKey={2}"
, "http", ConfigurationManager.AppSettings["storageAccountName"],
ConfigurationManager.AppSettings["storageAccountKey"]); var account = CloudStorageAccount.Parse(storageConnnectString);; // create blob client CloudBlobClient blobStorage = account.CreateCloudBlobClient(); CloudBlobContainer container = blobStorage.GetContainerReference("<storagecontainername>"); container.CreateIfNotExist(); //Create the shared access permission and policy BlobContainerPermissions containerPermissions = new BlobContainerPermissions(); string sas = container.GetSharedAccessSignature(new SharedAccessPolicy() { SharedAccessExpiryTime = DateTime.UtcNow.AddMinutes(30), Permissions = SharedAccessPermissions.Write | SharedAccessPermissions.Read }); //Turn off public access containerPermissions.PublicAccess = BlobContainerPublicAccessType.Off; container.SetPermissions(containerPermissions); string uniqueBlobName = string.Format(fileName); //Assign the shared access policy CloudBlobClient blobClient = new CloudBlobClient(account.BlobEndpoint, new
StorageCredentialsSharedAccessSignature(sas)); //Get a point to the blob object CloudBlob blb = blobClient.GetBlobReference(uniqueBlobName); string fileLocation = @"C:\Documents\"; int pos = fileName.IndexOf('/'); string fname = fileName.Substring(pos + 1, fileName.Length - pos - 1 ); //Download the blob object blb.DownloadToFile(fileLocation + fname); System.Console.WriteLine("File successfully downloaded to " + fileLocation + fname); return "File successfully downloaded to " + fileLocation + fname; } catch (StorageClientException e) { return "Blob Storage error encountered: " + e.Message; } catch (Exception e) { return "Error encountered: " + e.Message; } finally { } }

You may have noticed that when we created the policy we didn’t specify a SharedAccessStartTime attribute.  We can specify a start time that policy will be good for or we can leave it off in which case the policy will go into effect immediately.

NOTE:  The files names are case sensitive.  If you attempt to find a blob and are not using lower case for the file name you will receive a return error

Outer Exception

Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.

Inner Exception Message

{"The remote server returned an error: (403) Forbidden."}

Blog Post by: Stephen Kaufman

Monitor your BizTalk environment using PowerShell – SQL Agent Jobs Monitoring

Monitor your BizTalk environment using PowerShell – SQL Agent Jobs Monitoring

One of the principal needs for BizTalk Administrators is the ability to monitor the health of BizTalk environments and react promptly to possible problems, you can accomplished this by using certain tools such as: BizTalk Administration Console; BizTalk360; SCOM and many more However, unfortunately many times, some of these tools are not available for us […]
Blog Post by: Sandro Pereira

Installing the Service Bus 1.0 Beta on Windows Server 2012

Recently I created a new virtual machine with Windows Server 2012, SQL Server 2012 and Visual Studio 2012 to try out the new features but I did not really have a purpose for it. After reading the blog post from Richard Seroter about Installing and Testing the New Service Bus for Windows I was very curious whether the Service Bus for Windows Server also works on my freshly installed VM!

 

Installation

The installation process for the Service Bus for Windows Server described in the sections below allows you to install and configure the software on Windows Server 2012.

The installation files of the Service Bus for Windows Server can be found at:   http://www.microsoft.com/en-us/download/details.aspx?id=30376

 

The Web Platform Installer starts when the installation link is clicked

The Prerequisites dialog appears with a list of prerequisite components that are not
present on the computer

The components are automatically downloaded and installed
 

To finish the computer must be rebooted at the end of the installation process

 

Configuration

Installation of the the Service Bus is is quite straightforward but configuring must be done using PowerShell

On MSDN is a PowerShell Cmdlets Reference with all the cmdlets that you can use for configuring the Service Bus

First create a new farm with the New-SBFarm cmdlet.

Add the machine to the Farm with the Add-SBHost cmdlet.

Create a new namespace entry in the farm with the New-SBNamespace cmdlet.

 

Verifying the Configuration

After setup has finished verify that the configuration completed correctly.

Check if the databases are created in SQL Server

Retrieve the Service Bus for Windows Server status with the Get-SBFarmStatus cmdlet.

You can also check if the services are running in the Server Manager

 

Connect to the Service Bus Namespace

The Service Bus Explorer allows users to administer messaging entities in an easy manner. The version provided on the download page for the Service Bus for Windows Server supports the Service Bus 1.0 Beta.
In the “ServiceBusExplorer-Server.zip” file is only the sourcecode of the Service Bus Explorer. You can open the solution in Visual Studio 2012 and run it.

First fill in the namespace settings to connect the namespace.

When you connect to the localhost by using a dot, it gets stuck behind the uri so you have to remove it.

Use the PrimarySymmetricKey from the New-SBNamespace result in the “Issuer Secret” field

Click on “Ok” to connect to the namespace

You can find more information about the Service Bus Explorer on:
http://msdn.microsoft.com/en-us/library/hh532261(v=VS.103).aspx
http://soa-thoughts.blogspot.nl/2012/06/visual-studio-service-bus-explorer.html

 

Conclusion

The installation was very easy. Configuration was slightly harder because a timeout occurred when the host started. First I had to remove the host with “Remove-SBHost” and rebooted the machine before I could add the host again but the second time the “Add-SBHost” cmdlet did the job! 🙂

Capabilities and Limitations of “Contract First” Feature in Microsoft Workflow Services 4.5

Capabilities and Limitations of “Contract First” Feature in Microsoft Workflow Services 4.5

I think we’ve moved well past the point of believing that “every service should be a workflow” and other things that I heard when Microsoft was first plugging their Workflow Foundation. However, there still seem to be many cases where executing a visually modeled workflow is useful. Specifically, they are very helpful when you have […]
Blog Post by: Richard Seroter