Wednesday, February 25, 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.

 image
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.

image

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

image
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.
image
I hope now you are clear on how to enable Failed Request tracing and were you can see the Trace log files.

Tuesday, February 17, 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.
image
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.
image
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.

Sunday, February 15, 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.

image

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.
image
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.
image
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

image
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.

Wednesday, February 11, 2015

Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, 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=2.0.0.0, 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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

image
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.

Tuesday, February 3, 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.

image

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.
image
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.
image

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

image

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.
image 

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.

Monday, February 2, 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.

image
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…”

image
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”.
image
Now you enter the comment for the commit and click on “Commit” button.
image 
Once it is committed you will get a message your commit is created locally. Sync to share your changes with the server.
image
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.
image
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.
image
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.
image
I hope you enjoyed reading this article. Tomorrow we will see how to commit the changes, how to add team members etc.

Sunday, February 1, 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.

image
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.
image
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.
image
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.

image
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.

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

 image

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.