Friday, June 19, 2015

Webinar - Test Driven Application development on June 28th 8:00 PM

We are starting webinar in DotNetSpider. You may find many good technical sessions soon from DotNetSpider.

Fist webinar will be presented by Mr.. Gaurav Arora who is one of the senior member of DotNetSpider.

Gaurav will be presenting “Test driven application development” in his webinar scheduled on 28th June 8:00 PM

Request all my readers to make use of this opportunity. We will be soon coming up with Azure series…wait and watch.

Please joined this session on 28th June 8:00 PM to 9:30 PM.

You may just open the below link to join this session.
Meeting ID: WP8QRC
Entry Code: g)$F3SBxp

Monday, March 16, 2015

How to create One ASP.NET application / What is One ASP.NET?

Did you ever face an interview question “What is One ASP.NET?” Did you ever create One ASP.NET web application? Do you know how to create One ASP.NET web application? All these questions will be answered here.

First lets find the answer for “What is One ASP.NET?”

As the name suggests One ASP.NET, it is a one ASP.NET project for multiple .NET supported technologies. Now you have MVC, WEB API, ASP.NET etc where you can create web application. How about creating one ASP.NET project and integrating all these technologies. Microsoft was reading our developers mind and they came up with ONE ASP.NET concepts in the same way what we all are thinking.

Now you just need to create one web project and then you can decide what technology you wanted to use at any time without any migration from one to another. Which means you can pick the technology at any time no need to decide everything in advance.

In order to create One ASP.NET project you should have Visual Studio 2013 and Update 1 or above.

Now, lets see how to create ONE ASP.NET project.

It is again the standard template as usual you see when you create new project from Visual Studio.

Lets see the step by step process to create the One ASP.NET project.

First thing is, if you don’t have .NET framework 4.5.1 and visual studio 2013 with minimum update 1 then install that.

Once you install the above Open Visual Studio 2013 and go to File—> New—>Project


Select Visual C# and then select the .NET framework 4.5 or 4.5.1.and then select the ASP.NET Web Application. As soon as you click on “ASP.NET Web Application” template you may see the description of this template in the right pane as using this you can create ASP.NET web forms, MVC etc, type of applications.


Click OK to create the project and start your application as per your requirement.

I hope now you understood what is One ASP.NET and how to create One ASP.NET project using Visual Studio 2013.

Thanks a lot for reading my article. Keep visiting my blog!

Wednesday, March 11, 2015

Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load a program with an incorrect format. - WCF IIS Hosting error

“Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load a program with an incorrect format” is an error which you get while hosting the WCF service in IIS.

Lets see the complete exception details first,

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.BadImageFormatException: Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load a program with an incorrect format.


Reason for this error:

You get this error normally when you try to host a WCF service developed in Windows 32 bit machine and you are trying to host this in a 64 bit machine.

Solution to this issue is a simple one, you just need to change the settings in IIS to enable 32 bit application hosting.

Lets see the step step by actions to change this settings.

Open IIS --> Press Start button + R and then type inetmgr.

Expand your server and then click on Application Pools

In the list of application pools select the application pool which is being used by your new WCF service. And then click on the “Advance Settings…”


In Advance Settings dialog change the Enable 32-Bit Applications settings from False to True and Click OK.


Now you browse your WCF service and see the result. I am sure your error would have disappeared.

Tuesday, March 10, 2015

Can we insert explicit values into IDENTITY column in MS SQL

This is one of my favorite interview question. I hope you also would have faced this question, if not then there is a high possibility that you may face it soon!
Answer to the question Can we insert explicit values into IDENTITY column is MS SQL is YES. You can insert values into the IDENTITY column as you require.

Lets start step by step.

First lets create a table for the demo purpose,
    Id int IDENTITY (1, 1) not null,
    Name varchar(50) not null,
    [Address] varchar (100) not null,
    Phone char (15) not null
Table is ready, now we will insert some values to the above table.
INSERT INTO [DemoIdentity] ([Name] ,[Address] ,[Phone]) VALUES ('Asheej','Bangalore','9916123456')
INSERT INTO [DemoIdentity] ([Name] ,[Address] ,[Phone]) VALUES ('David','Birmingham','7543789234')
INSERT INTO [DemoIdentity] ([Name] ,[Address] ,[Phone]) VALUES ('Cliff','Columbus','4081234567')

Above is the standard way to insert the values into the table which has IDENTITY column.
Now lets try to insert a value with identity column value,

INSERT INTO [DemoIdentity] ([ID], [Name] ,[Address] ,[Phone]) VALUES (4,'Johnson','Perth','61478976782')

If you execute above SQL statement you will get below error,
Msg 544, Level 16, State 1, Line 11
Cannot insert explicit value for identity column in table 'DemoIdentity' when IDENTITY_INSERT is set to OFF.

Yes, now we will see the property which MS SQL provides you to insert values in IDENTITY column.
In SQL we have the property named IDENTITY_INSERT. Whenever you wanted to insert values to an IDENTITY column we just need to enable the property IDENTITY_INSERT.
Lets enable this property and insert a value in above table.
Syntax for enabling the IDENTITY_INSERT is,

Now we will insert the value by executing the same above statement by specifying the IDENTITY column value and see the result.
One important thing you have to remember is, in order to enable or disable the IDENTITY_INSERT  property you should be part of the sysadmin group.

Make sure you disable the IDENTITY_INSERT ON once you are done with the insert statement as this column is not intended to insert the values explicitly.
Syntax for disabling the IDENTITY_INSERT is,
I hope now you understood the whole concept of the property IDENTITY_INSERT and how you can insert explicit values into an IDENTITY column.

Friday, March 6, 2015

The requested content appears to be script and will not be served by the static file handler – WCF IIS Hosting error

This is one of the most confusing error you get while hosting WCF service in IIS. Solution is simple but the error description completely misleads you to think in all the direction.
Below is the exact error,

HTTP Error 404.17 - Not Found
The requested content appears to be script and will not be served by the static file handler.


The reason for the error is when you host a WCF service which is developed in .NET Framework 4.0 or 4.5 then while deploying by default IIS select .NET Framework 2.0.

In order to resolve this issue go to IIS and change the .NET Framework to the version which was used to develop your WCF service.
The exact step would be,

Press Start button  + R  and then type inetmgr.

Expand your server and then click on Application Pools

In the list of application pools select the application pool which is being used by your new WCF service.

Here you would have already noticed the wrong framework associated with your WCF service.

Just double click on the WCF Service name and change the .NET Framework version.

Click OK to save the changes. Now you browse your WCF service all your issues with your WCF service hosting error would have resolved.

Monday, March 2, 2015

Where to find log files for the ASP.NET web application hosted in Windows Azure?

If you are a developer then definitely one of the question haunting you once you deploy your web application in Windows Azure is where is the log file? How can I go through the default log files which we have in IIS or in any other web server.

In this article all your such query will be answered. Once you login to your windows Azure account and open the web application configuration section you will find the option to configure all the log files, but there is no options available there to download or to view the log files. You may find all below options under Configure Menu but not the option to view the log files.


Lets see the available options to view the log files.

There are two ways you can view the log files related to your web applications deployed in Windows Azure.

1. Kudu Console. If you are hearing this first time then you may read my earlier article “” Once you open KUDU console you just need to go to the Tools menu and then you will find an option “Diagnostic dump” By clicking on this item will download the whole log files dump in your local system. Once you have the dump then nothing more to write about what you have to do.


2. Using Visual Studio: This one is interesting as you will be seeing the log files from your Visual Studio itself. In order to view the log files first you need to connect your Visual Studio with your Windows Azure account. If you are not aware of this feature, I have already written an article for you “”.  

Once you connect to your Visual Studio to your Windows Azure account then Expand Azure—>Websites—>Now expand the website name which you wanted to view the log files.

As soon as you expand your website which you wanted to view the log files you might have noticed a folder named “Log Files” This is our target today.
Lets expand the files and see the subfolders inside Log Files.
One thing you have to remember is this folder structure under log files in totally depends on the logging mechanism you have enabled for your application.
If you have enabled all the available logging then you may find many folders for each logs.
For your information I have expanded few of my already deployed in applications in my Windows Azure account.
Try to pen each log files under each folder if you like to explore more about the log files.

I hope you are now clear about the available log files in Windows Azure and how you can download or view this log files for debugging the issues.

Thanks a ton for reading my article and I hope it will help in your application development.

As usual you are always welcome to give feed back to my articles which may help me to improve next time.

Thursday, February 26, 2015

How to Enable Failed-Request Tracing / Not able to find Failed-Request Tracing option in IIS

Sometimes we have to enable Failed request tracing in order to trace the issues in the server. Normally we use Failed Request tracing to know what exactly is happening with the request. Best examples to enable Failed Request tracing is to find out the performance issues, authentication failures, Server 500 error, 404 error etc.

Sometimes when you try to configure the Failed Request Tracing you may not find that option because you may not have installed the IIS components to enable that feature. So first lets see the place where you will find this option.

Lets open IIS first, press Window + R button or Start –>Run and then type inetmgr.
Expand your system name—>Sites—> Click on Default Web Site.

Now look at your right side window “Actions” In Actions pane under Configure section you should get “Failed Request Tracing…. “ option.

Sometimes as I mentioned above you may not see this option. It will be like below screen.

In such cases first we will install the required component.

Go to Control Panel\All Control Panel Items\Programs and Features and then click on Turn Windows features on or off.

Go to Internet Information Service-->World Wide Web Services--> Application Development Features—> Select ASP.NET

Expand Health and Diagnostics—>Select Tracing

Click OK to install this component.


Once you install above components open IIS again and go to the Action and under Configure section you can see Failed Request Tracing…

To enable Failed Request Tracing Click on the link “Failed Request Tracing…. “ and select the Enable button. You can also change the path in case you wanted to save this log file in a different location than the default location. Also as you can see you will be able to change the Maximum number of trace files as well. This is to avoid your Disk getting full with trace files. Last 50 or 100 file would be sufficient to investigate any issues.
I hope now you are clear on how to enable Failed Request tracing and were you can see the Trace log files.

Wednesday, February 18, 2015

App Suspended feature in .NET Framework 4.5.1

Today we will go through one of the new feature added in .NET framework 4.5.1. This feature is currently available only in Windows Server 2012 R2. Microsoft may add this in other operating systems later but currently this is restricted to Windows Server 2012 R2.

App Suspend is a new configuration in IIS in Windows Server 2012 R2. We will see what is the advantage we are going to get if use this configuration and also will see where we have to change this configuration.

First thing first! What is the advantage of using app suspend?

If you enable this great feature your application start up will be much faster and in single webserver server you can host multiple application without impacting the performance.
Now, lets see how enable this feature.

In order to enable first we will open IIS from your Windows Server 2012 R2. Open IIS—> Select Application Pools—> Right Click on Application Pools and then select the “Advance Settings…”.

In advanced Settings window you will not see this feature anywhere! isn’t it? Yes you cannot see this feature directly. This feature is part of the “Idle Time-out” settings.
You would have noticed a special configuration here that is nothing but the “Idle Time-Out Action” this is currently available only Windows Server 2012 R2. This is the configuration we have to change. By default it will be selected as “Terminate”.
Just click on this dropdown to see that the new option “Suspend”. and select the same and click on OK to return.
That’s all you have to do, you are done!!!

If you like to test this feature then change the default time to 2 min or something and access the application. Also change the setting back to terminate and see your application start up time difference.
I hope you understood the advantage of this App Suspend feature and you will try this in your application.

Monday, February 16, 2015

Visual Studio In-built Support for Windows Azure

As you are aware Visual Studio has evolved a lot and every new release Microsoft adds many features. Since Windows azure is the hot cake in the market, of course Microsoft added many inbuilt features in Visual Studio 2013. Today we are going to explore few important features which will help you to debug your application.
Lets go through one by one, lets connect to Windows Azure website form Visual Studio.

Now you can directly connect to your Azure website from Visual Studio. IN order to connect to the windows azure, first you need to sign in to your Azure account. If you are already connected then you can directly open the server explorer form View Menu.


Once you open Server Explorer, you can find an option named “Azure”. You may expand the Azure to find the available options under that. This links nothing but what you see once you login to your Azure account.
You can compare the feature list below. Except Visual Studio online everything can be found there. Visual Studio online is a different configuration so that is available under Team explorer in Visual Studio.

 image image
Now what we are going to explore is the features available under Websites.
Lets expand the Websites, you will notice that all the websites which is already hosted in your Azure account will listed there.
We will concentrate on one website now and will see what we can do directly from Visual Studio.
Lets right click on one website and select View Settings. You will be amazed to see the options which is opened in your right panel. Lets explore one by one now.
First one you would see is the Stop Website and Restart Website. If the website is in the stopped state you will find an option Start Website in place of Stop Website. As you are aware you stop the application inn windows Azure as well same like the way you do it in IIS.

I believe nothing more to explain this feature as it has got its literal meaning.

Next options which shows under Website Settings are mainly for debugging.

First option is definitely the Framework version. You will have two options either V4.5 or V3.5

You may choose the framework version depends on the one you want to run your application.

Next four settings are related to remote debugging.
1. Web Server Logging
2. Detailed Error Messages
3. Failed Request Tracing
4. Application Logging (File System)
5. Remote Debugging

You may enable all or the require logging options in case you are facing any issues with the application. It is very easy to know what exactly is the issue your application is facing by going through this log files. As soon as you change this logging options it will reflect in Windows Azure as well. Which means instead of logging-in to your windows Azure  account you may manage all these options from Visual Studio itself.

I will be stopping today, there are much more to explain about the log files which you are going to get by enabling this logging mechanism.

I will be writing a separate articles for each logs.
Thanks a lot of reading my article.

Thursday, February 12, 2015

Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Recently when I was debugging my application I got the error “Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Below is the exact error I have received.

Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

I was very mush sure that I have proper permission in my system and also I am running Visual Studio in Administrator mode. So there is no way I should get security exception.

First thing I checked was the TRUST level in web.config but found that it was set to FullTrust. They suddenly I realized that I am running the code from remote share, I mean from the network drive.Therefore, the remote share that holds the Web applications content requires FullTrust.

There are two ways to solve this error,

1. Copy the complete code in your local drive and run, since you are an administrator to your system there won’t be any issues.

2. Provide FullTrust to your network drive. To provide FullTrust to your network drive you have to follow certain steps. This steps are already documented in Microsoft KB article. I would like you to go through this steps in case if you are interested to provide FullTrust to your network drive.

I hope you are able to resolve this issue now and you are able to debug your application without any problem.

Thanks for reading my article. Please rate the article by clicking on the buttons below.

Wednesday, February 4, 2015

How to add team members and share code in Visual Studio online

This seems to be a small topic and a simple. Since I have been continuing the Visual Studio Online series I thought this is also important. If you don’t know how to add members and how to share the code which is already upload in your Visual Studio Online account then the whole idea is going to be waste.

Lets login to the Visual Studio online account first. Once you login you will find all the projects under your account. In this demo you will find only one project that is DemoVSOnline.


Just click on the project where you wanted to add the user and share the code. When you click on the project new page will be opened. I have highlighted two sections below. because first highlighted section is interesting.
You might have noticed “Team rooms” which has been highlighted. What exactly is Team room? Here comes the new idea from Microsoft. Suppose you have 5 to 6 members working on the same project and they are connected from remote locations. How do you contact them??? that is a challenge. So Microsoft thought about that and added a team room where you can interact with the whole team working on this project.

Second highlighted section is of course to add the members to your project.

Click on the “Manage…” button to open the page to add the uses.

Select “Add user” option to add the user. The screen which opens to add the user is self explanatory.


As an additional note, In order to add user to your project first you need to add the user to your Visual Studio online account.
If you haven’t read my earlier article related to this, the process is very simple, Go to your Visual Studio Account Home page. Now you will find a menu Users. Just click on that link to open the Manage Users page where you can add/delete/modify any users.
You can use Microsoft account or even other account as well. If you use Microsoft account there will be an added advantage. You may see the actual window which you have to use to add the user below.

I hope now you are confident enough to add the user to your visual studio online account and to your project and also you learned how to chat with your team member via Team room.

Any doubt or questions related to this topic is always welcome.

Tuesday, February 3, 2015

How to add ASP.NET projects in Visual Studio online

Yesterday we learned how to create project in Visual Studio online and how to create local work space for that project. If you have learned that please go through my earlier article “How to create projects in Visual Studio Online”.

Today What we are going to do is, we will add complete ASP.NET project to the Visual Studio online project we have created yesterday.

For that first what we have to do is, if you already have a project then just copy the code into the local work space. Otherwise create a new project and save the project in your local workspace.
Here in my example I have already a project so I am copying the code from my original location to the local workspace.

Once you move the project to your local work space then open Visual Studio and then open the solution/Project we just copied in to the local workspace.

Once you open the solution click on TEAM menu and select “Connect to Team Foundation Server…”

Now it is time to Sync the code in VS online project which we created. Click On the “Changes” option and then Click on the Add All button to include all the files. You may nitice that as soon as you click on Add All, all the file be added to the “Included Changes”.
Now you enter the comment for the commit and click on “Commit” button.
Once it is committed you will get a message your commit is created locally. Sync to share your changes with the server.
Just click on the Sync link to open the Sync page and now you can see the button with the name “Sync”. Just click on it to Sync the code.
As soon you click on the Sync code you can see the progress of your code syncing. It may take some time depends on the project size and of course your internet speed as it will be uploaded to Visual Studio online account.
Once committing is completed you will get a successfully committed the change message and you are done!
Just login to your Visual Studio online account and see the code you have committed.
I hope you enjoyed reading this article. Tomorrow we will see how to commit the changes, how to add team members etc.

Monday, February 2, 2015

How to create projects in Visual Studio Online

I hope you would already heard what is Visual Studio online and what is the purpose and advantages of using Visual Studio online. This is one of the simplest easy way to manage your code across the world without any headache of transferring code from one server to another. You create a visual Studio online account add the projects to it and then share with your team member who is sitting anywhere in the world.

In this article I am going to explain you how to create/Add projects in Visual Studio online and then how to share with your team member.

First I have created a simple website with a single page. While creating the project now in Visual Studio 2013 you can find a new option called “Team Project”.

You can use Visual Studio 2012. You can also use Visual Studio 2010, but you'll need to install Service Pack 1 and KB2662296 first. Or, you can use Visual Studio 2008 SP1, with this GDR update.
Select this option to create a new project which can be added to your Visual Studio online account.

If you already connected with your MSDN account then your Visual Studio online URL will show in the Team Foundation Server dropdownlist. See the window which I see when try to create a new projects in Visual Studio online.
If it is not connected then you can click on the “Servers…” button and then click on the “Add…” button to provide the URL of your VS online.
It might ask you to provide your credentials. Once you enter the credentials it will open your Visual Studio online account as well as your project.

If you are doing this first time then you have to create your local workspace. Similar to any source control tool. So click on close this repository or create work space option. Select the path where you wanted to keep the local copy of your code.

Once your local work space is created your empty Visual Studio online project is ready. Now you just click on the Web Portal link which will take you to the online account and there you can see that the new project.

Once you are redirected the online account you may see the project we created now like below.


So your first project is online now. Now you can share with any of your team member. I will be writing more article towards sharing the code, committing the changes etc in coming days.

Saturday, January 31, 2015

Rank VS Dense_Rank in MS SQL

Today we will some interesting SQL feature. You would have seen in SQL RANK and DENSE_Rank function. Did you ever think why we have these two functions and what exactly is the difference between RANK and DENSE_RANK in MS SQL.

My task for the day is to teach you the difference between RANK and DENSE_Rank in MS SQL.

First I will give a small description about the difference and then we will go through the sample.

RANK—> Rank function will help you to find the RANK within your ordered partition. If you have same rank for the two rows then the next rank will be skipped. Which means if you have 3 items with the same rank as 3 then the next rank will be 6. 4th and 5th rank will be skipped.

DENSE_RANK—> Dense_Rank function will help you to rank the the item within your partition same like RANK function but it will not skip any ranking, it will be consecutive. Which means if you have the same scenario we taken above that is 3 items with the same rank as 3 then the next rank will be 4 in case of dense_rank.

Now lets see the demo.

First we will create the table
CREATE TABLE [dbo].[tblStatistics](
    [ID] [numeric](18, 0) NULL,
    [Name] [varchar](50) NULL,
    [Salary] [numeric](18, 0) NULL,
    [City] [nchar](20) NULL
Lets query the table and see the output,
Above one is the simple select query. Now we will query using RANK and DENSE_RANK together to see the difference.

Rank and Rank_Dense query syntax is slightly different from our regular query as you have to mention the partition in query.

      ,RANK() over (partition by City order by Salary) Rank_Demo
      ,dense_rank() over (partition by City order by Salary) Dense_Rank_Demo
      FROM [tblStatistics]
Lets execute above query and see the result.

You would have noticed that the skipping happened in the RANK for Rank column and consecutive rank for the Rank_Dense column in the above screen print.

That’s you learned the difference between RANK and DENSE_RANK in SQL.

Thanks for reading my article!

Thursday, January 29, 2015

Compatibility level 90 is deprecated in MS SQL 2014

As we are going to use MS SQL 2014 in near future, compatibility level setting is one of the important thing we should know. Especially when you are migrating SQL from older version we should set this compatibility level properly otherwise your database migration will be a flop.

In MS SQL 2014 Microsoft declared that compatibility level 90 is deprecated.

What it means for the DBA or a developer?

To know the answer for the above question first you should know what is compatibility level. I will give you a short table below to understand how it is related to each version MS SQL.
Compatibility Level
MS SQL Server Version
Applies to
80 SQL Server 2000 SQL Server 2008 through SQL Server 2008 R2
90 SQL Server 2005 SQL Server 2008 through SQL Server 2012
100 SQL Server 2008 and SQL Server 2008 R2 SQL Server 2008 through SQL Server 2014
110 SQL Server 2012 SQL Server 2012 through SQL Server 2014
120 SQL Server 2014 SQL Server 2014 through SQL Server 2014
Now you might be clear what is this compatibility level all about and why Level 90 is deprecated in SQL 2014.

When Microsoft says compatibility level 90 is deprecated which means when you are migrating from SQL server 2005 or older version to SQL server 2014 you have to change the compatibility level from 90 to 100, that is the minimum compatibility level SQL 2014 supports.

Once you install SQL server 2014 then the default compatibility level will be set it as 120. Where as when you migrate your database from older version database retains its existing compatibility level if it is at least 100, which means it retains its compatibility level if the database you are migrating is SQL 2008 or above.

So here comes the catch. What will happen if you are migrating SQL server 2005 or older version. In such cases we have to change the compatibility level to 100 manually.
Microsoft recommends below steps to change the compatibility level,
  1. Login to the database and set the database to single-user access mode by using ALTER DATABASE SET SINGLE_USER.
  2. Change the compatibility level of the database.
    ALTER DATABASE AdventureWorks2012
  3. Put the database in multiuser access mode by using ALTER DATABASE SET MULTI_USER.

Other option is login to the database. Select the DB you wanted to change the compatibility level and then right click to open the properties.
Click on properties and then select Options. Scroll down to change the Database to Single User mode and then click OK.

Now click on the Compatibility level dropdown and select the preferred compatibility level. Once you change the compatibility level then scroll down again and change the database to multi user mode.
You are done now!!!

I would like to offer you further reading in this regard too, here is the MSDN link related to the same topic.

I hope you enjoyed reading this and learnt something interesting.

Tuesday, January 27, 2015

Role based access in Windows Azure

This is one of the demand every subscriber was asking to Microsoft and finally they came up with the proper solution. So now you don’t need to have multiple subscription for development, test and production. Everything can be managed by single subscription.

Today I will be taking you through the simple steps to add the users with different rights in Windows azure.

Windows Azure has got 3 roles now,

To add to this roles, Microsoft suggest you to configure Active directory with these roles and add the users to this active directory group.

For example, If you would like to add the user “Martin” then you need to him to the active directory to the respective role, i.e. read, write or contributor role. Once you add him to the AD then his name can be selected from the Azure.

Lets see how can you select the existing AD user or how you can add a guest user.

In order to add the users first click on Browse—>Everything and then click on the item “Subscriptions…”. This will show all the subscriptions you have in your account in case you have multiple subscriptions.
Select the subscription you wanted to add the user. Once you select the subscription it will show the roles in the right pane. Now select the role you wanted to add the user.

If you wanted to add a read only user then click on the reader option. This will again open a right pane to add the user.

Click on the ADD button to add the user from the Active directory. As soon as you type in if the user is part of the Active Directory which is synced with the Azure it will automatically pops up.

Here you will find an option to invite the user as well. If the user already have a Microsoft account you may use that to provide Azure access.

I hope you are very clear about the steps you need to follow to provide role based access to Windows Azure.

I have a further reading link in case you require more information regarding this.