SvcPerf-WCF trace tool and WCF debugging in ETW

Posted by Unknown 0 comments
SvcPerf-WCF trace tool and WCF debugging in ETW:


SvcPerf - An End-to-End trace Analysis tool for WCF:


In .net framework 4.5 introduced end to end trace tool for WCF project is called SvcPerf.Which very use full tool for WCF developers to debug and trace the WCF code.

               We have a large number of tools that allow ETW analysis and the one aspect we wanted to do was to allow activity correlation which WCF uses extensively. Folks who have already used ETW in its full capacity already know about ETW activities and how they are propagated. Those of you who don't, this FAQ: Common Questions for ETW and Windows Event Log should be a good start point. Others who just want to jump in, hop over to the tool page here -http://svcperf.codeplex.com/


Pros of ETW
  1. Ability to control it dynamically compared to System.Diagnostics
  2. One of the fastest tracing mechanisms in the Operating System
  3. Well understood formats of producing and consuming traces.
  4. Inherent concepts of Activities and correlation.
  5. Real-time analysis capabilities, even in production environments.
Some of the not so great features are
  1. Lot of tools available which causes confusion in the tool to be used.
  2. Cannot be easily read with text analysis tools due to binary format of the file
  3. File format can be better optimized.
  4. Collection is machine wide and can impact the system if there are large number of WCF services on the box.
Despite these issues ETW offers one of the most robust tracing infrastructures on the platform. With that in mind we build our End-to-End(E2E) tracing for WCF. We needed to make multiple layers understand and consistent with our E2E model. We also needed to be able to correlate a large number of scenarios from our transports all the way to our dispatchers. We have large number of pumps in multiple layers and being extremely asynchronous means that you lose the ability to depend on things like TLS and ExecutionContext etc. With these in mind we choose a model where we explicitly flow our correlation across layers and use it when stamping our events. This also means that we need to be able to stitch causality chains for request analysis.
  • Note: This does not deprecate Diagnostics Tracing and neither is it guaranteed to provide feature parity. Instead we consider this as new capability which we can use for production analysis cases where we would not like process restarts or configuration changes to running applications. Also for 4.5 we do not have message logging which still requires configuration and can be done only through Diagnostics Tracing.

Why do we need another tool?

The other more popular ETW tools like Xperf and WPA have a good amount of analysis capability already built in them but they are not tuned for statistical analysis of data. For e.g. given a trace how do you find out which are your slow requests or how to obtain a distribution of your request processing times. These kinds of question were better answered with SQL like queries. That said there are log parsers that have this capability but we wanted to work on raw ETL and this is where SvcPerf comes into play. Besides being a quick ETL viewer it also is a query engine built on top of Tx (LINQ over Traces).
clip_image001
In the above screen shot you can see that Activities are correlated for you and the ETW fields like ActivityID and RelatedActivityID are can be directly queried.
If you want to just give the tool a try you can get it from here. SvcPerf.exe (It is self-signed and will give you a warning but if you want you can try to compile the source as well provided you remove the strongname.).
To collect the trace use logman with the WCF provider and you also need the manifest so that events can be decoded. Refer - http://svcperf.codeplex.com/wikipage?title=How%20do%20I%20collect%20an%20ETL%20trace%20for%20WF%2fWCF%3f&referringTitle=FAQs
Labels: ,

unable to start debugging on the webserver.The server doesnt suport debugging of asp.net or ATL server applications

Posted by Unknown 0 comments
Exception: The server does not support debugging of ASP.NET or ATL server applications.

If you have an XP Pro or W2K Pro machine, you may need to think about the order of installation between VS.net 7.0 and IIS. If you install IIS after VS.net 7.0, you will get this error. In this case, please register “aspnet_isapi.dll” with “aspnet_regiis.exe –i”.


Exception: Error while trying to run project: Unable to start debugging on the web server. The project is not configured to be debugged. 

When trying to run/debug my ASP.Net web app from VS.NET (2003) I get this error:
Error while trying to run project: Unable to start debugging on the web server. The project is not configured to be debugged.

This was caused because I had renamed the virtual dir that the project resides in - and because of this IIS had decided to revert the dir from an application to a dir.

To resolve simply make it an app again via the IIS Management tool:
Within the IIS management tool, select your virtual dir.
Right-click and select Properties
In the Properties dialog box, click on the Create button.


Exception: Unable to start debugging on the web server 

Your IIS application of IIS is not configured to use “integrated Windows authentication”. Please make sure that the “integrated windows authentication” checkbox on the “authentication method” dialog box is checked.


Exception: The project is not configured to be debugged.
You need to make sure that your web is configured for debugging. To do this, you need set “debug = true” in the “web.config” file. You may find this file in your web project folder.


Exception: Could not start ASP.NET or ATL server debugging.
You may have installed “IIS Lockdown” tool. If so, Please find “urlscan.ini” file, and add “DEBUG”(case sensitive) into “[allowverbs]” section in “urlscan.ini” file.


Exception: Access is denied. 
You may be the member of “Debugger users” group, but you don’t have the right to debug the aspnet worker process, because you are not the “aspnet” user account or the member of “Administrators” group. Please add your user account to the “Administrators” group on the machine.


Exception: The debugger is not properly installed.

If you see this problem, please check debugging with console application project. And if the console application project shows the error message like

It means that your .Net framework is not installed properly. So you need to register “mscordbi.dll” manually by executing “regsvr32 mscordbi.dll”.


Exception: Do not have permission to debug the server
Problem 1: Make sure that “Integrated Windows Authentication” is enabled. Probably, you enabled only “Basic authentication” for Directory security of IIS.

Problem 2: If you are using “Integrated Windows authentication”, you need to make sure that your user account has full control on the directory of the IIS.

Problem 3: If you created the web project with a full machine name (like “machinename.domainname.something”), the web site is recognized as “Internet” site. So the default setting of IE will impact on the behavior of log on. In this case, you need to enable logging on with your current user account in “Internet” area with IE setting. But it is not the default setting of IE, so you’d be better off if you create project with only the machine name.


Breakpoint is not working, Can start debugging without error message, but breakpoints are not hit.
You started debugging with “F5” and it looks like debugging is started properly, and IE is launched properly. But you can’t hit a breakpoint on my code behind code.

Problem 1: Please make sure that “asp.net debugging” is enabled in the properties of project.

In the case of VB project, the UI is different. But you can recognize the equivalent one easily.

Problem 2: Please make sure that the expected DLL is loaded with matched debug symbol file. You can check it with “Modules” window.


Exception: Server side-error occurred on sending debug HTTP request.

Problem 1: Your web application doesn’t have an Application name. Please check the properties of the web project using the IIS MMC to ensure that your web project has an application name

You need to create an application name for debugging.

Problem 2: If you are using the NTFS file format, please make sure that “aspnet” has proper privilege on “wwwroot” or your folder for virtualdirectory to access and write on the folders.
Labels:

Asp.net debugging errors with IIS server

Posted by Unknown 0 comments
Exception: The server does not support debugging of ASP.NET or ATL server applications.

If you have an XP Pro or W2K Pro machine, you may need to think about the order of installation between VS.net 7.0 and IIS. If you install IIS after VS.net 7.0, you will get this error. In this case, please register “aspnet_isapi.dll” with “aspnet_regiis.exe –i”.


Exception: Error while trying to run project: Unable to start debugging on the web server. The project is not configured to be debugged. 

When trying to run/debug my ASP.Net web app from VS.NET (2003) I get this error:
Error while trying to run project: Unable to start debugging on the web server. The project is not configured to be debugged.

This was caused because I had renamed the virtual dir that the project resides in - and because of this IIS had decided to revert the dir from an application to a dir.

To resolve simply make it an app again via the IIS Management tool:
Within the IIS management tool, select your virtual dir.
Right-click and select Properties
In the Properties dialog box, click on the Create button.


Exception: Unable to start debugging on the web server 

Your IIS application of IIS is not configured to use “integrated Windows authentication”. Please make sure that the “integrated windows authentication” checkbox on the “authentication method” dialog box is checked.


Exception: The project is not configured to be debugged.
You need to make sure that your web is configured for debugging. To do this, you need set “debug = true” in the “web.config” file. You may find this file in your web project folder.


Exception: Could not start ASP.NET or ATL server debugging.
You may have installed “IIS Lockdown” tool. If so, Please find “urlscan.ini” file, and add “DEBUG”(case sensitive) into “[allowverbs]” section in “urlscan.ini” file.


Exception: Access is denied. 
You may be the member of “Debugger users” group, but you don’t have the right to debug the aspnet worker process, because you are not the “aspnet” user account or the member of “Administrators” group. Please add your user account to the “Administrators” group on the machine.


Exception: The debugger is not properly installed.

If you see this problem, please check debugging with console application project. And if the console application project shows the error message like

It means that your .Net framework is not installed properly. So you need to register “mscordbi.dll” manually by executing “regsvr32 mscordbi.dll”.


Exception: Do not have permission to debug the server
Problem 1: Make sure that “Integrated Windows Authentication” is enabled. Probably, you enabled only “Basic authentication” for Directory security of IIS.

Problem 2: If you are using “Integrated Windows authentication”, you need to make sure that your user account has full control on the directory of the IIS.

Problem 3: If you created the web project with a full machine name (like “machinename.domainname.something”), the web site is recognized as “Internet” site. So the default setting of IE will impact on the behavior of log on. In this case, you need to enable logging on with your current user account in “Internet” area with IE setting. But it is not the default setting of IE, so you’d be better off if you create project with only the machine name.


Breakpoint is not working, Can start debugging without error message, but breakpoints are not hit.
You started debugging with “F5” and it looks like debugging is started properly, and IE is launched properly. But you can’t hit a breakpoint on my code behind code.

Problem 1: Please make sure that “asp.net debugging” is enabled in the properties of project.

In the case of VB project, the UI is different. But you can recognize the equivalent one easily.

Problem 2: Please make sure that the expected DLL is loaded with matched debug symbol file. You can check it with “Modules” window.


Exception: Server side-error occurred on sending debug HTTP request.

Problem 1: Your web application doesn’t have an Application name. Please check the properties of the web project using the IIS MMC to ensure that your web project has an application name

You need to create an application name for debugging.

Problem 2: If you are using the NTFS file format, please make sure that “aspnet” has proper privilege on “wwwroot” or your folder for virtualdirectory to access and write on the folders.
Labels:

system.runtime.serialization.json not found solution [Solved]

Posted by Unknown 1 comments
system.runtime.serialization.json not found solution [Solved]:

while am doing code with windows phone i found a issue is that i didn't find the name space system.runtime.serialization.json
i found issue was when we are using async programming system.runtime.serialization.json will not work
In order to fix these issue we have to give reference of System.ServiceModel.Web.dll

so we have to give 2 reference 
using System.ServiceModel.Web.dll;
using system.runtime.serialization.json;

hope this will help your in coding
Labels:

MVC Single Page Application Template Update for ASP.NET and Web Tools 2012.2 RC - .NET Web Development and Tools Blog - Site Home - MSDN Blogs

Posted by Unknown 0 comments
Labels: ,

image retrieving in mvc with web response

Posted by Unknown 0 comments

image retrieving in mvc with web response

in this blog am going to explain you about image retrieving in mvc with web response.

In order to do i have taken once actin method in controller which will sends you the response in bytes with a web request.

In the view page i have taken image tag and a button.upon a button click i want to call a web request and render the response in to image tag.

In the Controller 

public HttpResponseMessage GetImage()
  {
   HttpResponseMessage response = new HttpResponseMessage();

     TypeConverter typeConverter = TypeDescriptor.GetConverter(typeof(Bitmap));
   Bitmap bmp = (Bitmap)typeConverter.ConvertFrom(yourImage);

            
   //3
   var Fs = new FileStream(HostingEnvironment.MapPath("~/Images") + @"\I" + Id.ToString() + ".png", FileMode.Create);
   bmp.Save(Fs,ImageFormat.Png);
   bmp.Dispose();

   //4
   Image img = Image.FromStream(Fs);
   Fs.Close();
   Fs.Dispose();

   //5
   MemoryStream ms = new MemoryStream();
   img.Save(ms, ImageFormat.Png);

   //6
   response.Content = new ByteArrayContent(ms.ToArray());
   ms.Close();
   ms.Dispose();
             
   response.Content.Headers.ContentType = new     MediaTypeHeaderValue("image/png");
           response.StatusCode = HttpStatusCode.OK;
            return response;
  }
}
}


In the view Page
<table>
<tr>
  <td>
   <input type="button" id="btngetemp" value="Get Employee" />
  </td>
</tr>
<tr>
  <td>
   <img id="emimage" src="" height="100" width="100"/>
  </td>
</tr>
</table>
Add the following script in the view:
<script type="text/javascript">
$(document).ready(function () {
  $("#btngetemp").click(function () {
 
  $("#emimage").attr("src", "http://localhost:4208/ctrllr/GetImage/");
});
});
</script>


Labels: ,

Dropdownlist with checkboxes in asp.net

Posted by Unknown 0 comments
Dropdownlist with checkboxes in asp.net:

In  this article am going to explain you about dropdownlist with checkboxes. I have used placeholder, dropdownlist, checkboxlist,anchor and div to achieve this.This has been tasted on IE 8 and chrome.


DropDownList with checkbox

Let's see how we can do this.

Step 1:

<table>
      
<tr
>
            
<td valign="top" style="width
165px">
                  
<asp:PlaceHolder ID="phDDLCHK" runat="server"></asp:PlaceHolder
>
            
</td
>
            
<td valign
="top">
                  
<asp:Button ID="btn" runat="server" Text="Get Checked" OnClick="btn_Click" 
/>
            
</td
>
            
<td valign
="top">
                  
<asp:Label ID="lblSelectedItem" runat="server"></asp:Label
>
            
</td
>
      
</tr
></table><asp:HiddenField ID="hidList" runat="server" />

Step 2: Add below lines of code on page load.

protected void Page_Load(object sender, EventArgs e)
{
      DropDownList ddl = new DropDownList
();
      ddl.ID = "ddlChkList"
;
      ListItem lstItem = new ListItem
();
      ddl.Items.Insert(0, lstItem);
      ddl.Width = new Unit
(155);
      ddl.Attributes.Add("onmousedown""showdivonClick()"
);
      CheckBoxList chkBxLst = new CheckBoxList
();
      chkBxLst.ID = "chkLstItem"
;
      chkBxLst.Attributes.Add("onmouseover""showdiv()"
);
      DataTable
 dtListItem = GetListItem();
      int
 rowNo = dtListItem.Rows.Count;
      string lstValue = string
.Empty;
      string lstID = string
.Empty;
      for (int
 i = 0; i < rowNo - 1; i++)
      {
            lstValue = dtListItem.Rows[i]["Value"
].ToString();
            lstID = dtListItem.Rows[i]["ID"
].ToString();
            lstItem = new ListItem("<a href=\"javascript:void(0)\" id=\"alst\" style=\"text-decoration:none;color:Black; \" onclick=\"getSelectedItem(' " + lstValue + "','" + i + "','" + lstID + "','anchor');\">" + lstValue + "</a>", dtListItem.Rows[i]["ID"
].ToString());
            lstItem.Attributes.Add("onclick""getSelectedItem('" + lstValue + "','" + i + "','" + lstID + "','listItem');"
);
            chkBxLst.Items.Add(lstItem);
      }
      System.Web.UI.HtmlControls.HtmlGenericControl div = new System.Web.UI.HtmlControls.HtmlGenericControl("div"
);
      div.ID = "divChkList"
;
      div.Controls.Add(chkBxLst);
      div.Style.Add("border""black 1px solid"
);
      div.Style.Add("width""160px"
);
      div.Style.Add("height""180px"
);
      div.Style.Add("overflow""AUTO"
);
      div.Style.Add("display""none"
);
      phDDLCHK.Controls.Add(ddl);
      phDDLCHK.Controls.Add(div);
}

Step 3: 
Place below javascript method in the aspx page  or you can place it in .js file and include it in the page. 
showdiv method will be called on mouse over of div.
showdivonClick will be invoked on click of dropdownlist.
getSelectedItem will be called on click of checkbox and anchor.
check will be call on any click on the page basically it is used to hide the div on click of any where on the page apart from div.

<script language="javascript" type="text/javascript">
      
function
 showdiv() {
            document.getElementById("divChkList").style.display = "block"
;
      }
      function showdivonClick() {
            var objDLL = document.getElementById("divChkList"
);
            if (objDLL.style.display == "block"
)
                  objDLL.style.display = "none"
;
            else
 
                  objDLL.style.display = "block"
;
      }
      function getSelectedItem(lstValue, lstNo, lstID, ctrlType) {
            var
 noItemChecked = 0;
            var ddlReport = document.getElementById("ddlChkList"
);
            var selectedItems = ""
;
            var arr = document.getElementById("chkLstItem").getElementsByTagName('input'
);
            var arrlbl = document.getElementById("chkLstItem").getElementsByTagName('label'
);
            var objLstId = document.getElementById('hidList'
);
            for
 (i = 0; i < arr.length; i++) {
                  checkbox = arr[i];
                  if
 (i == lstNo) {
                        if (ctrlType == 'anchor'
) {
                              if
 (!checkbox.checked) {
                                    checkbox.checked = true
;
                              }
                              else
 {
                                    checkbox.checked = false
;
                              }
                        }
                  }
                  if
 (checkbox.checked) {
                        if (selectedItems == ""
) {
                              selectedItems = arrlbl[i].innerText;
                        }
                        else
 {
                              selectedItems = selectedItems + ","
 + arrlbl[i].innerText;
                        }
                        noItemChecked = noItemChecked + 1;
                  }
            }
            ddlReport.title = selectedItems;
            var
 Text = ddlReport.options[ddlReport.selectedIndex].text;
            if
 (noItemChecked == 1)
                  ddlReport.options[ddlReport.selectedIndex].text = lstValue;
            
else
                  
ddlReport.options[ddlReport.selectedIndex].text = noItemChecked + " Items"
;
            document.getElementById('hidList'
).value = ddlReport.options[ddlReport.selectedIndex].text;
      }
      
      
document.onclick = check;
    
      
function
 check(e) {
            var
 target = (e && e.target) || (event && event.srcElement);
            var obj = document.getElementById('divChkList'
);
            var obj1 = document.getElementById('ddlChkList'
);
            if (target.id != "alst" && !target.id.match("chkLstItem"
)) {
                  if (!(target == obj || target == obj1)) {

                        
obj.style.display = 'none'
                  
}
                  else if (target == obj || target == obj1) {

                        if (obj.style.display == 'block') {
                              obj.style.display = 'block'
;
                        }
                        else
 {
                              obj.style.display = 'none'
;
                              document.getElementById('ddlChkList'
).blur();
                        }
                  }
            }
      }
</script>

Step 4: btn_Click method will be used to get to get the selected checkbox status in the dropdownlist.

protected void btn_Click(object sender, EventArgs e)
{
      string strSelectedItem = string
.Empty;
      CheckBoxList chk = (CheckBoxList)phDDLCHK.FindControl("chkLstItem"
);
      DropDownList ddl = (DropDownList)Page.FindControl("ddlChkList"
);
      for (int
 i = 0; i < chk.Items.Count; i++)
      {
            if
 (chk.Items[i].Selected)
            {
                  if
 (strSelectedItem.Length == 0)
                  {
                        strSelectedItem = chk.Items[i].Selected.ToString();
                  }
                  
else
                  
{
                        strSelectedItem = strSelectedItem + ","
 + chk.Items[i].Selected.ToString();
                  }
            }
      }
      ddl.Items.Clear();
      ddl.Items.Add(new ListItem
(hidList.Value));
      lblSelectedItem.Text = strSelectedItem;
}
Step 5: Now add a method to get datatable which will be bind to checkboxlist.

public DataTable GetListItem()
{
      DataTable table = new DataTable
();
      table.Columns.Add("ID"typeof(int
));
      table.Columns.Add("Value"typeof(string
));
      table.Rows.Add(1, "ListItem1"
);
      table.Rows.Add(2, "ListItem2"
);
      table.Rows.Add(3, "ListItem3"
);
      table.Rows.Add(4, "My ListItem Wraps also"
);
      table.Rows.Add(5, "My New ListItem5"
);
      table.Rows.Add(6, "ListItem6"
);
      table.Rows.Add(7, "ListItem7"
);
      table.Rows.Add(8, "ListItem8"
);
      return
 table;
}



This ends the article of dropdownlist with checkbox.
Labels: ,
 
test