Certificate error when deploying WCF Azure Service

Last night I was working on some Azure WCF Service and while deploying on the Windows Azure Platform, I continuously faced error that “The certificate with thumbprint was not found in windows azure”. It was a simple WCF service based on BasicHttpBinding and has few operation contracts.

After doing deep research I found that while packaging a service from Package Windows Azure Application window, if you select “Enable Remote Desktop for all roles” or “Enable Remote Debugger for all roles” it expect to have certificates uploaded on azure portal and you should have specified the exact thumbprint in the Certificates section from properties window. Otherwise your deployment does not succeed.

Therefore, I succeeded disabling these two checks while creating a package and also made sure that there were no <certificates></certificates> tags inside service definition (.csdef) file and service configuration (.cscfg) file.

Hope this helps!

Email document via Office 365 Exchange Web Services Managed API 1.1 from Windows File Context Menu

I was just exploring the Microsoft Exchange Web Services API for Office 365 through which you can programmatically perform several operations on Office 365 Exchange account.

In this post i will walk you through the application which sends the selected file to particular recipient as an attachment. It does not only sends a document but also registers a new context menu on files/document in windows registry that gives an option to user to just select the file and email it as an attachment.

Below snap shows the console window that displays the processing log when the user initiated the request.

Let’s start with the actual work.

1. First of all you need to create an Office365 account from MS Office365 site and download the Microsoft Exchange Web API 1.1. from Microsoft Exchange Web Services API 1.1..

2. Now there are two projects mainly, one which creates an entry into registry. For this i have created a windows application that makes an entry into the registry. Other one is the console application which sends a document selected to the recipient specified in the app.config. This is just for the demo purpose you can also specify a list somewhere in the database etc and read the recipient addresses from there.

3. Below is the screen shot of the Windows form application from where the user creates a context menu in the windows registry at file level.

Above screen show two text field controls named Menu Name and Exe Path. In the “Menu Name” text field we just specify the menu we want to create in the windows registry where as the “Exe Path” holds the executable (in our case a console application) that launches when user click on that menu.

Following is the code snippet for making an entry into registry.

private void btnCreate_Click(object sender, EventArgs e)

RegistryKey regmenu = null;
RegistryKey regcmd = null;
regmenu = Registry.ClassesRoot.CreateSubKey(MenuName);
if (regmenu != null)
regmenu.SetValue("", this.txtMenuName.Text);

regcmd = Registry.ClassesRoot.CreateSubKey(Command);
if (regcmd != null)
regcmd.SetValue("", this.txtExecutablePath.Text+ " \"%1\"");

catch (Exception ex)
MessageBox.Show(this, ex.ToString());
if (regmenu != null)
if (regcmd != null)

This will create an entry into the registry.

Lets now create a console application which will use Web Exchange API to send emails.

4. Create a new Console Application project.

5. Add Reference to  Microsoft.Exchange.WebServices.

6. Following code snippet shows the way of using Web Exchange Service and send an email as an attachment.

class Program
static String _primaryLabUserId;
static ExchangeService _service;
static void Main(string[] args)
String filepath = args[0].ToString();
Console.WriteLine("Sending Email");
SendEmail("From_address@youroffice365domain.com", "to_Address@abc.com", "Subject", "Body", filepath);
Console.WriteLine("Email Sent!");

private static void ConnectToExchangeService()
//PrimaryLabUserId is your Office 365 Id. Specify PrimaryLabUserId in app.config under AppSettings tag
if (String.IsNullOrEmpty(System.Configuration.ConfigurationSettings.AppSettings["PrimaryLabUserId"]))
throw new ArgumentNullException("Please provide value for PrimaryLabUserId in app.config");

_primaryLabUserId = ConfigurationSettings.AppSettings["PrimaryLabUserId"];

// Create an instance of ExchangeService for a specific version of Exchange Server
_service = new ExchangeService(ExchangeVersion.Exchange2010);
_service.Credentials = new System.Net.NetworkCredential()
UserName = _primaryLabUserId,
Password = "yourPassword";

// Call Autodiscover to return the Url of the most efficient CAS server for the given email address
_service.AutodiscoverUrl(_primaryLabUserId, UrlValidationCallback);

private static bool UrlValidationCallback(string redirectionUrl) { return true; }
private static void SendEmail(string from, string to, string subject, string body, string attachmentName)
//Create an email message and initialize it with the from address, to address, subject and the body of the email.
EmailMessage emailMessage = new EmailMessage(_service);

//Specified Recipients
EmailAddress addressTo = new EmailAddress();
addressTo.Address = to;

//Specified From
emailMessage.From = new EmailAddress() { Address = from };
emailMessage.Subject = subject;
emailMessage.Body = body;

Below is the screen shot of the email item received on my Inbox at Office 365 exchange.

Happy Coding !

How to resolve Azure Storage Emulator start up issue

I was just exploring Azure Toolkit 1.4 and when I ran the application I got the following error. Following post shows the way to resolve this issue.

Actually Windows Azure storage emulator by default works on a  SQL Server Express instance which needs to be named ‘SQLExpress’. If you open the SQL Server Management Studio you can see the DevelopmentStorageDb20090919 database is created when install the Azure Toolkit.

We have to configure the named instance or default instance that we have registered in SQL Server (other than SQL Express)

1. Open Windows Azure command prompt from Program Files > Windows Azure SDK 1.4

2. For default Instance: write DSInit /sqlinstance:. 


3. For named instance: write DSInit /sqlinstance:<named_instance> 

For e.g if you have .\sharepoint, then write DSInit /sqlinstance:sharepoint

4. On running this statement it will popup the window and create the emulator storage database on the instance specified.

4. Now start the storage emulator and enjoy coding on Azure.