<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Real world problems; Real world solutions</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/sudeepg/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/sudeepg/feed.xml</link>
    <description>Forum to share my experiences supporting IIS, ASP.NET &amp;amp; SharePoint technologies and an attempt to explain how these technologies work below the surface. I discuss some of the issues that we resolved in our support cases.</description>
    <lastBuildDate>Sat, 11 Apr 2015 04:41:26 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>debugging a crash – An example</title>
      <link>https://docs.microsoft.com/archive/blogs/sudeepg/debugging-a-crash-an-example</link>
      <pubDate>Thu, 29 Apr 2010 05:05:00 GMT</pubDate>
      <dc:creator><![CDATA[sudeepg]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sudeepg/2010/04/29/debugging-a-crash-an-example/</guid>
      <description><![CDATA[Debugging &amp; troubleshooting applications is a major part of my job, but not using debuggers like...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><span style="font-size: small">Debugging &amp; troubleshooting applications is a major part of my job, but not using debuggers like WinDBG. Although I have a great liking around using the debuggers, I don’t spend a lot of my time these days using this debugger. So when I get time, I generally read books and use sample code to brush up my debugging skills. I had read the book – Advanced Windows Debugging a couple of times. I recently picked up one of the examples from the book to debug a crash. The book uses a slightly different approach to debugging the example problem. It gives us the liberty of source + private symbols. Unfortunately, in support, when we get memory dumps we get the state of the crash and usually won’t have access to third party source &amp; symbols. So why not blog about how I understood the cause of the crash from a support perspective?</span></span></span></p>  <p><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><span style="font-size: small">The sample is plain and simple. The program takes an argument of type string. I am instructed to run it under a debugger – WinDBG &amp; pass a string as command line argument which is long and it should crash the application. The task is to determine why the program crashed.&#160; </span></span></span></p>  <p><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><span style="font-size: small">The moment the program starts running, it breaks into the debugger upon hitting the initial breakpoint. Thereafter, I just type ‘g’ and hit enter to let the program run. As indicated, the program immediately crashes due to an Access Violation and breaks into the debugger.</span></span></span></p>  <p><span style="font-family: courier new; font-size: x-small"><span style="color: #000000"><font size="2">0:000&gt; g          <br /></font></span></span><span style="font-size: x-small"><span style="font-family: courier new"><span style="color: #000000"><font size="2">(114c.19b4): Access violation - code c0000005 (first chance)            <br />First chance exceptions are reported before any exception handling.             <br />This exception may be expected and handled.             <br />eax=000cfefc ebx=00000000 ecx=000cff3a edx=00502a36 esi=00000001 edi=0100367c             <br />eip=010012a7 esp=000cff44 ebp=000c0000 iopl=0&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; nv up ei pl nz na pe nc             <br />cs=0023&#160; ss=002b&#160; ds=002b&#160; es=002b&#160; fs=0053&#160; gs=002b&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; efl=00010206             <br />05Program!wmain+0x17:             <br />010012a7 8b550c&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; mov&#160;&#160;&#160;&#160; edx,dword ptr [ebp+0Ch] ss:002b:000c000c=????????</font></span></span></span></p>  <p><span style="font-size: x-small"><span style="font-family: segoe ui"><span style="color: #000000"><font size="2">From this, I can tell a few things as to why we crashed. The system attempted to de-reference a pointer located at the address contained in EBP register with an offset of 0C. We attempted to dereference the pointer so that we can store its value in the register EDX. The value we got was invalid and is at location 000c00c</font></span></span></span></p>  <p><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">OK, so why is this address bad? What is the type of address we attempted to de-reference?</font></span></span></p>  <p><span style="font-size: x-small"><span style="font-family: courier new"><span style="color: #000000"><font size="2">0:000&gt; !address 000c000c            <br />TEB 7efdd000 in range 7efdb000 7efde000             <br />ProcessParametrs 00251788 in range 00250000 00256000             <br />Environment 00250810 in range 00250000 00256000             <br />&#160;&#160;&#160; 00090000 : 00090000 - 0003c000             <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Type&#160;&#160;&#160;&#160; 00020000 MEM_PRIVATE             <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; State&#160;&#160;&#160; 00002000 MEM_RESERVE             <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Usage&#160;&#160;&#160; RegionUsageStack             <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Pid.Tid&#160; 114c.19b4</font></span></span></span></p>  <p><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">Alright; so we know this address is on the stack and it is for the thread with the id 19b4. If I list the threads in this process, here is what I get.</font></span></span></p>  <p><span style="font-family: courier new; font-size: x-small"><span style="color: #000000"><font size="2">0:000&gt; </font></span></span><span style="font-size: x-small"><span style="font-family: courier new"><span style="color: #000000"><font size="2">~            <br />.&#160; 0&#160; Id: 114c.19b4 Suspend: 1 Teb: 7efdd000 Unfrozen</font></span></span></span></p>  <p><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">So there is only one thread in this process and this address is on the stack space allocated for the crashing thread. Is this address valid?</font></span></span></p>  <p><span style="font-size: x-small"><span style="font-family: courier new"><span style="color: #000000"><font size="2">0:000&gt; </font></span><span style="color: #000000"><font size="2">dd 000c000c l4            <br />000c000c&#160; ???????? ???????? ???????? ????????</font></span></span></span></p>  <p><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">Obviously, not! The key thing to note here is that this invalid address is an offset from the EBP register, which we do not manipulate directly from our code. However, it is a key register in managing access to parameters and local variables for a call frame. An understanding of how stack works will help debug this better. Here’s a diagram.</font></span></span></p>  <table style="width: 688px" border="1" cellspacing="0" cellpadding="2"><tbody>     <tr>       <td valign="top" width="341" align="center"><span style="font-family: segoe ui; font-size: x-small"><font size="2">Stack Layout</font></span></td>        <td valign="top" width="345" align="center"><span style="font-family: segoe ui; font-size: x-small"><font size="2">Overflow into saved EBP</font></span></td>     </tr>      <tr>       <td valign="top" width="341"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/sudeepg/WindowsLiveWriter/debuggingacrash_115EA/StackLayout_2.png" original-url="http://blogs.msdn.com/blogfiles/sudeepg/WindowsLiveWriter/debuggingacrash_115EA/StackLayout_2.png"><font size="2"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="StackLayout" border="0" alt="StackLayout" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/sudeepg/WindowsLiveWriter/debuggingacrash_115EA/StackLayout_thumb.png" original-url="http://blogs.msdn.com/blogfiles/sudeepg/WindowsLiveWriter/debuggingacrash_115EA/StackLayout_thumb.png" width="272" height="320" /></font></a><font size="2"> </font></td>        <td valign="top" width="345"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/sudeepg/WindowsLiveWriter/debuggingacrash_115EA/StackLayout-Overflw_2.png" original-url="http://blogs.msdn.com/blogfiles/sudeepg/WindowsLiveWriter/debuggingacrash_115EA/StackLayout-Overflw_2.png"><font size="2"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="StackLayout-Overflw" border="0" alt="StackLayout-Overflw" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/sudeepg/WindowsLiveWriter/debuggingacrash_115EA/StackLayout-Overflw_thumb.png" original-url="http://blogs.msdn.com/blogfiles/sudeepg/WindowsLiveWriter/debuggingacrash_115EA/StackLayout-Overflw_thumb.png" width="209" height="323" /></font></a><font size="2"> </font></td>     </tr>   </tbody></table>  <p><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">Thus, it seems here that we are crashing due to a buffer overrun that corrupts the stack, specifically the EBP register. Let’s begin by looking at the callstack</font></span></span></p>  <p><span style="font-family: courier new; font-size: x-small"><span style="color: #000000"><font size="2">0:000&gt; kv          <br />ChildEBP RetAddr&#160; Args to Child&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />000cff44 01001467 00000002 00502940 00503ab0 05Program!wmain+0x17 (FPO: [Non-Fpo]) (CONV: cdecl)           <br />000cff88 76fa3677 7efde000 000cffd4 77ea9d72 05Program!__wmainCRTStartup+0x102 (FPO: [Non-Fpo]) (CONV: cdecl)           <br />000cff94 77ea9d72 7efde000 7697df09 00000000 kernel32!BaseThreadInitThunk+0xe (FPO: [Non-Fpo]) (CONV: fastcall)           <br />000cffd4 77ea9d45 010015a5 7efde000 00000000 ntdll!__RtlUserThreadStart+0x70 (FPO: [Non-Fpo]) (CONV: stdcall)           <br />000cffec 00000000 010015a5 7efde000 00000000 ntdll!_RtlUserThreadStart+0x1b (FPO: [Non-Fpo]) (CONV: stdcall)</font></span></span></p>  <p><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">Now, we need to go back in time to prove our theory. Where do we begin? One theory is that we can dis-assemble backwards from the current failure spot to find out the code we executed just before we crashed. Thus:</font></span></span></p>  <p><span style="font-family: courier new; font-size: x-small"><span style="color: #000000"><font size="2">0:000&gt; ub . l5          <br />05Program!wmain+0x9 :           <br />01001299 7523&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; jne&#160;&#160;&#160;&#160; 05Program!wmain+0x2e (010012be)           <br />0100129b 8b450c&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; mov&#160;&#160;&#160;&#160; </font></span></span><span style="font-size: x-small"><span style="font-family: courier new"><span style="color: #000000"><font size="2">eax,dword ptr [ebp+0Ch]            <br />0100129e 8b4804&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; mov&#160;&#160;&#160;&#160; ecx,dword ptr [eax+4]             <br />010012a1 51&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; push&#160;&#160;&#160; ecx             <br />010012a2 e839000000&#160;&#160;&#160;&#160;&#160; call&#160;&#160;&#160; 05Program!HelperFunction (010012e0)</font></span></span></span></p>  <p><span style="font-size: x-small"><span style="font-family: segoe ui"><span style="color: #000000"><font size="2">ub means un-assemble backwards and the period (.) means from the current EIP value. l5 means length; un-assemble 5 instructions. So the above command goes back 5 instructions from current value of EIP register and starts listing the instructions, which will give us the preceding 5 instructions. The highlighted one is the code that we executed just before we failed.</font></span></span></span></p>  <p><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">Similarly u means un-assemble forward from the current value of EIP. In the listing below, you can see the instruction that failed (highlighted):</font></span></span></p>  <p><span style="font-family: courier new; font-size: x-small"><span style="color: #000000"><font size="2">0:000&gt; u . l3          <br />05Program!wmain+0x17 :           <br /></font></span></span><span style="font-size: x-small"><span style="font-family: courier new"><span style="color: #000000"><font size="2">010012a7 8b550c&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; mov&#160;&#160;&#160;&#160; edx,dword ptr [ebp+0Ch]            <br />010012aa 8b4204&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; mov&#160;&#160;&#160;&#160; eax,dword ptr [edx+4]             <br />010012ad 50&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; push&#160;&#160;&#160; eax</font></span></span></span></p>  <p><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">Alright, so now we know that just before we failed, we called another function named HelperFunction at address 010012e0. If we look back 3 instructions before this function was called (green highlight), we see an access to the EBP register where we de-reference a pointer at ebp+0ch during the execution of the wmain function. We didn’t crash there, so we can be sure that the EBP register has the correct value when executing that instruction. Further, anytime we call a function, we always save the return address plus the EBP of the current call frame so that we can restore it upon returning from the function. In this case, we save the EBP for wmain method. Thus it stands to reason that after executing the function HelperFunction, somehow we corrupted the stack and overwrote the saved EBP value, which results in an access violation when we are back in the wmain method, because, the EBP register now is pointing to an location that is not correct for the wmain method.</font></span></span></p>  <p><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">Next, we investigate further by completely dis-assembling the HelperFunction using the uf command</font></span></span></p>  <p><span style="font-family: courier new; font-size: x-small"><span style="color: #000000"><font size="2">0:000&gt; uf 010012e0          <br />05Program!HelperFunction :&#160; <br />&#160;&#160; 010012e0 8bff&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; mov&#160;&#160;&#160;&#160; edi,edi&#160; <br />&#160;&#160; 010012e2 55&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; push&#160;&#160;&#160; ebp&#160; <br />&#160;&#160; 010012e3 8bec&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; mov&#160;&#160;&#160;&#160; ebp,esp&#160; <br />&#160;&#160; 010012e5 83ec3c&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sub&#160;&#160;&#160;&#160; esp,3Ch&#160; <br />&#160;&#160; 010012e8 8b4508&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; mov&#160;&#160;&#160;&#160; eax,dword ptr [ebp+8]&#160; <br />&#160;&#160; 010012eb 50&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; push&#160;&#160;&#160; eax&#160; <br />&#160;&#160; 010012ec 8d4dc4&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; lea&#160;&#160;&#160;&#160; ecx,[ebp-3Ch]&#160; <br />&#160;&#160; 010012ef 51&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; push&#160;&#160;&#160; ecx&#160; <br />&#160;&#160; 010012f0 ff1574100001&#160;&#160;&#160; call&#160;&#160;&#160; dword ptr [05Program!_imp__wcscpy (01001074)]&#160; <br />&#160;&#160; 010012f6 83c408&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; add&#160;&#160;&#160;&#160; esp,8&#160; <br />&#160;&#160; 010012f9 8be5&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; mov&#160;&#160;&#160;&#160; esp,ebp&#160; <br />&#160;&#160; 010012fb 5d&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; pop&#160;&#160;&#160;&#160; ebp&#160; <br />&#160;&#160; 010012fc c20400&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ret&#160;&#160;&#160;&#160; 4</font></span></span></p>  <p><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">Alright, so now we can see a few more things. </font></span></span></p>  <ul>   <li><font size="2" face="Segoe UI">First we see the standard function prologue. Save the current EBP (which is for wmain function &amp; move the stack pointer). </font></li>    <li><font size="2" face="Segoe UI">Allocate space for local variables. In this case we are allocating 60 bytes (3C hex – sub esp,3Ch) </font></li>    <li><font size="2" face="Segoe UI">Then we move the address of first parameter passed to HelperFunction into EAX register </font></li>    <li><font size="2" face="Segoe UI">Then push that address on the stack </font></li>    <li><font size="2" face="Segoe UI">The LEA stands for load effective address. So we push the beginning address for the space allocated for local variable into ECX register. </font></li>    <li><font size="2" face="Segoe UI">We then call the imported function WCSCPY. </font></li> </ul>  <p><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">The _imp__ before a function means it’s calling into another library. In this case a C runtime library. This method is used for copying a string from one variable to another using pointers. See the </font></span></span><a href="http://msdn.microsoft.com/en-us/library/kk6xf663(VS.71).aspx" target="_blank"><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">MSDN documentation.</font></span></span></a><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2"> So essentially, the HelperFunction passes the pointers to the source and destination to the WCSCPY function.</font></span></span></p>  <p><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">So now our theory is getting a bit stronger. The WCSCPY method is used to copy WCHAR (Wide character unicode strings) which are terminated with a NULL. Further, from experience, a developer may know that WCSCPY method does not check for bounds. We know that the space allocated on the stack was 60 bytes, which means the code declared a WCHAR string of size 30 bytes long. Why? Since the API we are using works on WCHAR types, we need 2 bytes to store each character and thus we allocate 60 bytes.</font></span></span></p>  <p><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">So, if we end up writing more than 60 bytes, we will overflow into the saved EBP of the wmain function and perhaps return address &amp; more depending on how large the string being copied is. Now our goal is to find out the length of the offending string and how much it has overflowed. Unfortunately, we are past execution of the code for HelperFunction where all of this happened and we have an EBP register value that is corrupt. So the stack has technically “unwound” since we returned from the HelperFunction. What that means is the stack pointer has unwound, but the values should still be there. So we can poke around a bit to get to that string value.</font></span></span></p>  <p><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">The problem is to find out what was the starting address on the stack where the allocation for this string begins. To do that, we need to try and visualize what all “existed” on the stack before we ended up in the current state. So what all gets stored on the stack?</font></span></span></p>  <ul>   <li><font size="2" face="Segoe UI">Parameters </font></li>    <li><font size="2" face="Segoe UI">Return Addess </font></li>    <li><font size="2" face="Segoe UI">Saved EBP </font></li>    <li><font size="2" face="Segoe UI">Local Variables </font></li> </ul>  <p><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">Given this fact, we can re-construct the stack to its previous state by examining the code in the HelperFunction. Usually, a good knowledge of assembly language is a plus point when doing this. I don’t know assembly much. I just use my favourite search engine (</font></span></span><a href="http://www.bing.com" target="_blank"><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">Bing</font></span></span></a><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">) to figure out what each instruction does and also refer the Intel x86 instruction code (available on Intel site) shared by my other colleagues.</font></span></span></p>  <p><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">To reconstruct the stack, we must keep in mind the current state of the stack and understand the execution path. As I mentioned before, we are back in the wmain function with a bad EBP register. Where is ESP register pointing to? At the top of the stack.</font></span></span></p>  <p><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">If we execute a “dps esp” command now, we can see this…</font></span></span></p>  <p><span style="font-family: courier new; font-size: x-small"><span style="color: #000000"><font size="2">0:000&gt; </font></span><span style="color: #000000"><font size="2">dps @esp          <br />000cff44&#160; 000cff88           <br />000cff48&#160; 01001467 05overrun!__wmainCRTStartup+0x102</font></span></span></p>  <p><font size="2"><font face="Segoe UI">… which means the stack pointer is pointing to saved EBP. In this case, it is for the __wmainCRTStartup method. So our stack pointer is still intact. If we look back at the dis-assembly for the HelperFunction, the last few instructions are as follows:</font><span style="color: #000000">&#160;&#160; <font face="Courier New">010012f0 ff1574100001&#160;&#160;&#160; call&#160;&#160;&#160; dword ptr [05Program!_imp__wcscpy </font></span></font></p>  <p><span style="font-family: courier new; font-size: x-small"><span style="color: #000000"><font size="2">010012f0 ff1574100001&#160;&#160;&#160; call&#160;&#160;&#160; dword ptr [05overrun!_imp__wcscpy (01001074)]          <br />010012f6 83c408&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; add&#160;&#160;&#160;&#160; esp,8           <br />010012f9 8be5&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; mov&#160;&#160;&#160;&#160; esp,ebp           <br />010012fb 5d&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; pop&#160;&#160;&#160;&#160; ebp           <br />010012fc c20400&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ret&#160;&#160;&#160;&#160; 4</font></span></span></p>  <p><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">So what does this do? After we return from executing the wcscpy method, we clean up the parameters passed to that method. It is also important to remember that the wcscpy function also restores the EBP for the HelperFunction. So the EBP register is now pointing to the correct location for HelperFunction. We then copy the value in the EBP register to the ESP register. Why? Before going back to wmain method, we need to restore its EBP. So this instruction simply moves the stack pointer to that location so that the next instruction (pop ebp) can copy the saved EBP value (now corrupt), for wmain method on the stack into the EBP register. The pop instruction also moves the stack pointer by 4 bytes. Thus, the stack pointer will now point to the return address within wmain.</font></span></span></p>  <p><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">Returning from the HelperFunction: This is the last step and the RET instruction pops the return address from the stack into the EIP register and the stack pointer also moves to 4 bytes. This gives control back to the calling function. Only the stack pointer and instruction pointers are modified by a subroutine return.</font></span></span></p>  <p><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">So since we are now ready to execute wmain again, the next instruction (mov&#160;&#160;&#160;&#160; edx,dword ptr [ebp+0Ch] ) is executed, but it fails since de-referencing EBP results in access violation.</font></span></span></p>  <p><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">So to reconstruct the stack and get to the local variable that overflowed, we factor in the following:</font></span></span></p>  <ul>   <li><font size="2" face="Segoe UI">Parameter passed to the HelperFunction (4 bytes) </font></li>    <li><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">The space required for saving of return address + EBP for the wmain method (4 bytes each) </font></span></span></li>    <li><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">The local variable of 60 bytes. </font></span></span></li> </ul>  <p><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">All of this adds up to 72 bytes. </font></span></span></p>  <p><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">NOTE: I am not factoring in what happens on the stack when 05Program!_imp__wcscpy function executes since locals variables and register values for that function will be saved in stack locations beyond what area we need to look up. Further the cleanup of the stack space allocated by that method will be done by the callee itself. (CDECL calling convention. In the CDECL calling convention the called function is responsible for cleanup of the stack). </font></span></span></p>  <p><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">So now, for the math – Since the stack grows in the reverse order, we need to subtract 72 bytes.</font></span></span></p>  <p><span style="font-size: x-small"><span style="font-family: courier new"><span style="color: #000000"><font size="2">0:000&gt; ?esp-0n72            <br />Evaluate expression: 851708 = 000cfefc</font></span></span></span></p>  <p><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">So now, we can use the dps command to dump the DWORDS and symbols as follows:</font></span></span></p>  <p><span style="font-family: courier new; font-size: x-small"><span style="color: #000000"><font size="2">0:000&gt; </font></span></span><span style="font-size: x-small"><span style="font-family: courier new"><span style="color: #000000"><font size="2">dps 000cfefc            <br />000cfefc&#160; 00520041 //             <br />000cff00&#160; 00610065 //             <br />000cff04&#160; 006c006c //             <br />000cff08&#160; 004c0079 //             <br />000cff0c&#160; 00720061 //             <br />000cff10&#160; 00650067 //             <br />000cff14&#160; 00420044 //             <br />000cff18&#160; 006f0043 // local variables             <br />000cff1c&#160; 006e006e //             <br />000cff20&#160; 00630065 //             <br />000cff24&#160; 00690074 //             <br />000cff28&#160; 006e006f //             <br />000cff2c&#160; 00740053 //             <br />000cff30&#160; 00690072 //             <br />000cff34&#160; 0067006e //             <br />000cff38&#160; 000c0000 //Saved EBP             <br />000cff3c&#160; 010012a7 05Program!wmain+0x17 </font></span></span></span><span style="color: #ffffff"><span style="font-size: x-small"><span style="font-family: courier new"><span style="color: #000000"><font size="2">//return address&#160; <br />000cff40&#160; 005029f8               <br />000cff44&#160; 000cff88               <br />000cff48&#160; 01001467 05Program!__wmainCRTStartup+0x102               <br />000cff4c&#160; 00000002               <br />000cff50&#160; 00502940               <br />000cff54&#160; 00503ab0               <br />000cff58&#160; 98f01d46               <br />000cff5c&#160; 00000000               <br />000cff60&#160; 00000000               <br />000cff64&#160; 7efde000               <br />000cff68&#160; 000cff74               <br />000cff6c&#160; 00000000               <br />000cff70&#160; 000cff58               <br />000cff74&#160; 8a754a32               <br />000cff78&#160; 000cffc4</font></span></span></span></span></p>  <p><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">The values on top of the stack now look like some text characters represented in hexadecimal values. For example, if we take the value 00520041 and start disassembling it from right to left in groups of 4 bits, we get 0041 and 0052. We can then run the .formats command</font></span></span></p>  <p><span style="font-family: courier new; font-size: x-small"><span style="color: #000000"><font size="2">0:000&gt; </font></span></span><span style="font-size: x-small"><span style="font-family: courier new"><span style="color: #000000"><font size="2">.formats 0041            <br />Evaluate expression:             <br />&#160; Hex:&#160;&#160;&#160;&#160; 00000041             <br />&#160; Decimal: 65             <br />&#160; Octal:&#160;&#160; 00000000101             <br />&#160; Binary:&#160; 00000000 00000000 00000000 01000001             <br />&#160; Chars:&#160;&#160; ...A             <br />&#160; Time:&#160;&#160;&#160; Thu Jan 01 05:31:05 1970             <br />&#160; Float:&#160;&#160; low 9.10844e-044 high 0             <br />&#160; Double:&#160; 3.21143e-322</font></span></span></span></p>  <p>   <br /><span style="font-family: courier new; font-size: x-small"><span style="color: #000000"><font size="2">0:000&gt; .formats 0052          <br />Evaluate expression:           <br />&#160; Hex:&#160;&#160;&#160;&#160; 00000052           <br />&#160; Decimal: 82           <br />&#160; Octal:&#160;&#160; 00000000122           <br />&#160; Binary:&#160; 00000000 00000000 00000000 01010010           <br />&#160; </font></span></span><span style="font-size: x-small"><span style="font-family: courier new"><span style="color: #000000"><font size="2">Chars:&#160;&#160; ...R            <br />&#160; Time:&#160;&#160;&#160; Thu Jan 01 05:31:22 1970             <br />&#160; Float:&#160;&#160; low 1.14906e-043 high 0             <br />&#160; Double:&#160; 4.05134e-322</font></span></span></span></p>  <p><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">From the highlighted section above, we can see that the first 2 are characters as we thought, since it was a string copy operation. So let’s dump the entire string. We can use the du command since it is a unicode string</font></span></span></p>  <p><span style="font-family: courier new; font-size: x-small"><span style="color: #000000"><font size="2">0:000&gt; du 000cfefc          <br />000cfefc&#160; &quot;AReallyLargeDBConnectionString&quot;</font></span></span></p>  <p><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">Alright, so now we have the offending string. The length of this string is 30 characters long. We allocated 60 bytes since this is a WCHAR string &amp; each character needs 2 bytes. So then why are we access violating? Let’s look at the dps command output again, specifically, the following lines.</font></span></span></p>  <p><span style="color: #000000"><span style="font-size: x-small"><span style="font-family: courier new"><font size="2">000cff34&#160; 0067006e            <br />000cff38&#160; 000c0000</font></span></span><font size="2" face="Courier New">        <br /></font></span></p>  <p><span style="font-family: segoe ui; font-size: x-small"><span style="color: #000000"><font size="2">The values in blue highlight are the last 2 digits of the string, which is “ng” and the values in cyan highlight is where we terminate the string. So we overflow into the Saved EBP register space of the stack by 2 bytes when we terminate the string, thus corrupting the saved EBP value on the stack. When we return from the function, this value is now stored into the EBP register. So now when we try to dereference locals and parameter values from the wmain function, we end up looking in the wrong memory location since the de-referencing is based on the relative address from the EBP register. In short, we have a stack corruption caused by a buffer overrun which is causing this crash.</font></span></span></p>  <p><span style="font-size: x-small"><span style="font-family: segoe ui"><font size="2"><span style="color: #0000ff">SOLUTION</span>: Most debugging books always mention this – Use only how much you allocate &amp; always check what you are writing fits into the allocated space. Since we allocated space for 30 characters, we can technically write only 29 characters and leave one byte for the string termination. The developer must validate the input string length to ensure it fits in the space allocated or throw an error message to gracefully handle the situation to avoid stack corruption. Even better, follow the recommendation/security note from the </font></span></span><a href="http://msdn.microsoft.com/en-us/library/kk6xf663(VS.71).aspx" target="_blank"><span style="font-family: segoe ui; font-size: x-small"><font size="2">MSDN Documentation</font></span></a><span style="font-family: segoe ui; font-size: x-small"><font size="2"> for this function which is:</font></span></p>  <p><span style="font-family: segoe ui; font-size: x-small"><font size="2">Security Note&#160; Because strcpy does not check for sufficient space in strDestination before copying strSource, it is a potential cause of buffer overruns. Consider using strncpy instead.</font></span></p>  <p><span style="font-family: segoe ui; font-size: x-small">&#160;</span></p>]]></content:encoded>
    </item>
    <item>
      <title>Webdav folders – no full functionality</title>
      <link>https://docs.microsoft.com/archive/blogs/sudeepg/webdav-folders-no-full-functionality</link>
      <pubDate>Fri, 02 Apr 2010 01:03:00 GMT</pubDate>
      <dc:creator><![CDATA[sudeepg]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sudeepg/2010/04/02/webdav-folders-no-full-functionality/</guid>
      <description><![CDATA[I recently got to work on a problem where MOSS 2007 SP2 was installed on a Windows 2008 machine. As...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: Segoe UI;"><span style="font-size: small;">I recently got to work on a problem where MOSS 2007 SP2 was installed on a Windows 2008 machine. As you all know, Windows 2008 comes with IIS 7.</span></span></p>
<p><span style="font-family: Segoe UI;"><span style="font-size: small;">The problem we had at hand had 2 particular symptoms</span></span></p>
<p><span style="font-family: Segoe UI;"><span style="font-size: small;">a. If we tried to access a SharePoint document library using UNC path, we will get back an error: &lt;path&gt; is not accessible. You might not have permission to use this resource.</span></span></p>
<p><span style="font-family: Segoe UI;"><span style="font-size: small;">b. If we browse to the document library using a browser, then select Explorer view, right click, we will get only the option New &gt; Folder. In other words, the options to create office documents and other types of files will not be present. A couple of screen shots of what is expected vs. What is available is given below</span></span></p>
<table cellpadding="2" cellspacing="0" border="0" style="width: 999px;">
<tbody>
<tr>
<td width="499" valign="top"><span style="font-family: Segoe UI;"><span style="font-size: small;">Expected</span></span></td>
<td width="499" valign="top"><span style="font-family: Segoe UI;"><span style="font-size: small;">Actual</span></span></td>
</tr>
<tr>
<td width="499" valign="top"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/sudeepg/WindowsLiveWriter/Webdavfoldersnofullfunctionality_1132D/clip_image002%5B5%5D.jpg" original-url="http://blogs.msdn.com/blogfiles/sudeepg/WindowsLiveWriter/Webdavfoldersnofullfunctionality_1132D/clip_image002%5B5%5D.jpg"><span style="font-size: small;"><img height="397" width="552" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/sudeepg/WindowsLiveWriter/Webdavfoldersnofullfunctionality_1132D/clip_image002%5B5%5D_thumb.jpg" original-url="http://blogs.msdn.com/blogfiles/sudeepg/WindowsLiveWriter/Webdavfoldersnofullfunctionality_1132D/clip_image002%5B5%5D_thumb.jpg" alt="clip_image002[5]" border="0" title="clip_image002[5]" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" /></span></a></td>
<td width="499" valign="top"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/sudeepg/WindowsLiveWriter/Webdavfoldersnofullfunctionality_1132D/clip_image002_2.jpg" original-url="http://blogs.msdn.com/blogfiles/sudeepg/WindowsLiveWriter/Webdavfoldersnofullfunctionality_1132D/clip_image002_2.jpg"><span style="font-size: small;"><img height="320" width="462" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/sudeepg/WindowsLiveWriter/Webdavfoldersnofullfunctionality_1132D/clip_image002_thumb.jpg" original-url="http://blogs.msdn.com/blogfiles/sudeepg/WindowsLiveWriter/Webdavfoldersnofullfunctionality_1132D/clip_image002_thumb.jpg" alt="clip_image002" border="0" title="clip_image002" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" /></span></a></td>
</tr>
</tbody>
</table>
<p><span style="font-family: Segoe UI; font-size: x-small;"><span style="color: #000000;"><span style="font-size: small;">Scoping Step 1: One of the things to remember is that IIS 7 comes with a new WebDav module. It can be downloaded from </span></span><a href="http://www.iis.net"><span style="color: #000000;"><span style="font-size: small;">www.iis.net</span></span></a><span style="color: #000000;"><span style="font-size: small;"> or installed along with adding the IIS web server role. That WebDav module does not work well with SharePoint sites. You can remove it specifically for SharePoint sites using the steps mentioned in this </span></span><a target="_blank" href="http://blogs.msdn.com/sudeepg/archive/2009/09/03/published-links-to-office-client-applications-do-not-show-up-in-file-open-or-save-dialogs.aspx"><span style="color: #000000;"><span style="font-size: small;">previous</span></span></a><span style="color: #000000;"><span style="font-size: small;"> blog post of mine. After I confirmed that the new WebDav module was not installed, we proceed to the next step.</span></span></span></p>
<p><span style="font-family: Segoe UI; font-size: x-small;"><span style="color: #000000;"><span style="font-size: small;">Scoping Step 2: If you see only New &gt; Folder option, that is a behaviour that usually occurs when MS FPRPC protocol is in use. WebClient service in prior versions of Windows does not work with ports other than 80. It is important to understand that this is a limitation of the WebClient service and not the WebDav protocol. So in such cases the option is to use FPRPC protocol. FPRPC does not allow the rich experience that WebDAV allows. By default, WebDAV is preferred over FPRPC so that the end user has a richer experience when interacting with the SharePoint system. Thus if you see the reduced functionality, it means one of the following:</span></span></span></p>
<ul>
<li><span style="font-family: Segoe UI; font-size: x-small;"><span style="color: #000000;"><span style="font-size: small;">WebClient service is disabled on the computer which forces the client to use FPRPC</span></span></span></li>
<li><span style="font-family: Segoe UI; font-size: x-small;"><span style="color: #000000;"><span style="font-size: small;">The site you are accessing is over a non standard protocol. (Limitation of the WebClient service, not protocol)</span></span></span></li>
</ul>
<p><span style="font-family: Segoe UI; font-size: x-small;"><span style="color: #000000;"><span style="font-size: small;">In this particular case the configuration was correct. WebClient service was started and further proof to this was that when accessing a SharePoint document library in another farm via Explorer View/UNC path, the full functionality was available. So there was no reason to suspect the client configuration.</span></span></span></p>
<p><span style="font-family: Segoe UI; font-size: x-small;"><span style="color: #000000;"><span style="font-size: small;">Scoping Step 3: At this point, I had verified the basics and got enough evidence to prove this is a server side problem. So the next logical step was to capture a network trace to view the underlying traffic. The steps on how to capture a network trace are available in an earlier blog post of mine.</span></span></span></p>
<p><span style="font-family: Segoe UI; font-size: x-small;"><span style="color: #000000;"><span style="font-size: small;">Below is how the traffic looks like when I filter traffic by WebDAV protocol. I have highlighted in yellow, the things I look at when reading the trace.</span></span></span></p>
<table cellpadding="2" cellspacing="0" border="1" style="width: 630px;">
<tbody>
<tr>
<td width="76" valign="top"><span style="font-family: Segoe UI; font-size: x-small;"><span style="color: #000000;"><span style="font-size: small;">CLIENT</span></span></span></td>
<td width="76" valign="top"><span style="font-family: Segoe UI; font-size: x-small;"><span style="color: #000000;"><span style="font-size: small;">SERVER</span></span></span></td>
<td width="476" valign="top"><span style="font-family: Segoe UI; font-size: x-small;"><span style="color: #000000;"><span style="font-size: small;">WEBDAV:Request, PROPFIND /sites</span></span></span></td>
</tr>
<tr>
<td width="76" valign="top"><span style="font-family: Segoe UI; font-size: x-small;"><span style="color: #000000;"><span style="font-size: small;">SERVER</span></span></span></td>
<td width="76" valign="top"><span style="font-family: Segoe UI; font-size: x-small;"><span style="color: #000000;"><span style="font-size: small;">CLIENT</span></span></span></td>
<td width="476" valign="top"><span style="font-size: x-small;"><span style="font-family: Segoe UI;"><span style="color: #000000;"><span style="font-size: small;">WEBDAV:Response, HTTP/1.1, Status Code = 401, URL: /sites</span></span></span></span></td>
</tr>
<tr>
<td width="76" valign="top"><span style="font-family: Segoe UI; font-size: x-small;"><span style="color: #000000;"><span style="font-size: small;">CLIENT</span></span></span></td>
<td width="76" valign="top"><span style="font-family: Segoe UI; font-size: x-small;"><span style="color: #000000;"><span style="font-size: small;">SERVER</span></span></span></td>
<td width="476" valign="top"><span style="font-family: Segoe UI; font-size: x-small;"><span style="color: #000000;"><span style="font-size: small;">WEBDAV:Request, PROPFIND /sites , Using NLMP Authentication</span></span></span></td>
</tr>
<tr>
<td width="76" valign="top"><span style="font-family: Segoe UI; font-size: x-small;"><span style="color: #000000;"><span style="font-size: small;">SERVER</span></span></span></td>
<td width="76" valign="top"><span style="font-family: Segoe UI; font-size: x-small;"><span style="color: #000000;"><span style="font-size: small;">CLIENT</span></span></span></td>
<td width="476" valign="top"><span style="font-size: x-small;"><span style="font-family: Segoe UI;"><span style="color: #000000;"><span style="font-size: small;">WEBDAV:Response, HTTP/1.1, Status Code = 401, URL: /sites</span></span></span></span></td>
</tr>
<tr>
<td width="76" valign="top"><span style="font-family: Segoe UI; font-size: x-small;"><span style="color: #000000;"><span style="font-size: small;">CLIENT</span></span></span></td>
<td width="76" valign="top"><span style="font-family: Segoe UI; font-size: x-small;"><span style="color: #000000;"><span style="font-size: small;">SERVER</span></span></span></td>
<td width="476" valign="top"><span style="font-family: Segoe UI; font-size: x-small;"><span style="color: #000000;"><span style="font-size: small;">WEBDAV:Request, PROPFIND /sites , Using NLMP Authentication</span></span></span></td>
</tr>
<tr>
<td width="76" valign="top"><span style="font-family: Segoe UI; font-size: x-small;"><span style="color: #000000;"><span style="font-size: small;">SERVER</span></span></span></td>
<td width="76" valign="top"><span style="font-family: Segoe UI; font-size: x-small;"><span style="color: #000000;"><span style="font-size: small;">CLIENT</span></span></span></td>
<td width="476" valign="top"><span style="font-size: x-small;"><span style="font-family: Segoe UI;"><span style="color: #000000;"><span style="font-size: small;">WEBDAV:Response, HTTP/1.1, Status Code = 404, URL: /sites</span></span></span></span></td>
</tr>
</tbody>
</table>
<p><span style="font-family: Segoe UI; font-size: x-small;"><span style="color: #000000;"><span style="font-size: small;">As you can see, the response the server is sending for an OPTIONS request is an HTTP 404. Unfortunately, there will be nothing in the ULS logs that you can use to further debug this. We debugged this problem and found the root cause. So I am just going to give you the answer now. After all blog is a way to share our domain knowledge, right?</span></span></span></p>
<p><span style="font-family: Segoe UI; font-size: x-small;"><span style="color: #000000;"><span style="font-size: small;">You will see this behaviour when accessing SharePoint document libraries <span style="text-decoration: underline;">if the root site collection does not exist.</span> The behaviour is that the server will send back an HTTP 404 response to the client. This can be easily reproduced by deleting the root site collection. Thus, if you see the above symptoms and have gone through the basics, capture a network trace and check if you see the response pattern as 401, 401, 404. If so, use the Central Administration website to check if the root site collection exists. If it doesn&rsquo;t, then you will see an option to select the root site &ldquo;/&rdquo; against the Web Site Address option in the Create Site Collection page.</span></span></span></p>
<p><span style="font-family: Segoe UI; font-size: x-small;"><span style="color: #000000;"><span style="font-size: small;">RESOLUTION &ndash; Create the root site collection with a blank site. If you do not wish to use it, just restrict access to the farm administrator using permissions.</span></span></span></p>
<p><span style="font-family: Segoe UI;"><span style="font-size: small;">&nbsp;</span></span></p>]]></content:encoded>
    </item>
    <item>
      <title>MOSS 2007 – request timed out browsing or during administrative tasks</title>
      <link>https://docs.microsoft.com/archive/blogs/sudeepg/moss-2007-request-timed-out-browsing-or-during-administrative-tasks</link>
      <pubDate>Sun, 28 Mar 2010 23:07:00 GMT</pubDate>
      <dc:creator><![CDATA[sudeepg]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sudeepg/2010/03/28/moss-2007-request-timed-out-browsing-or-during-administrative-tasks/</guid>
      <description><![CDATA[How many of you are running into this problem &amp; how many of you have been able to find out the...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: Segoe UI; font-size: small;">How many of you are running into this problem &amp; how many of you have been able to find out the cause for this? I am guessing quite a lot of them out there are running into this problem with SharePoint and very few may have found what the actual cause is. The truth is, this error can occur due to many different reasons, primarily due to performance. Recently, I had an opportunity to troubleshoot this problem for a production environment and what the cause turned out to be was quite interesting. So here&rsquo;s my story and hopefully it will help some of you out there being careful even when making simple customization changes.</span></p>
<p><span style="font-family: Segoe UI; font-size: small;">One of the first things to understand this behaviour is to understand what causes Request Timed Out Exception. If you turn off custom errors in SharePoint and set the CallStack attribute to true in the web.config file for the problem application, you will notice that the exception is of type <span style="background-color: #ffffff;"><strong><span style="color: #000000;">System.Web.HttpWebException</span>.</strong></span> This exception is thrown by the .NET CLR. The CLR provides a quantum of time to the managed thread that is executing the request. By default, this is 110 seconds in .NET CLR 2.0. If this threshold is reached, the request is aborted and this particular exception is thrown. Why do we do this? To prevent runaway threads. So this is actually a fail safe mechanism. However there are cases where you might need to adjust it to a higher value. Be careful when you do this because if you have lots of requests that are allowed to run for a long time, then you will end up exhausting the CLR threadpool causing more problems such as queuing of requests which appear as a hang. Unfortunately, there are a few Microsoft KB articles that recommend increasing this value to as high as 999999. My opinion is &ndash; Do not do this on production servers (atleast)</span></p>
<p><span style="font-family: Segoe UI; font-size: small;">So now that we know what causes this exception, let me explain how I went about getting to the root cause. First &ndash; We scoping the problem area. This takes up 90% of the time. Since this is a performance problem, there are a few possibilities</span></p>
<ul>
<li><span style="font-family: Segoe UI; font-size: small;">Possible performance issues with web server or SQL Server.</span></li>
<li><span style="font-family: Segoe UI; font-size: small;">Possible performance issue with a single site or site collection.</span></li>
</ul>
<p><span style="font-family: Segoe UI; font-size: small;">I am not including the network piece here &ndash; Why? Because this is a server side behaviour not network latency. The server is aborting the request because it has been running for too long. </span></p>
<p><span style="font-family: Segoe UI; font-size: small;">The problem did not have specific symptoms. It could occur while browsing any site within the site collection or performing administrative tasks such as adding users, creating sites, adding items to a list. So basically any activity could trigger this behaviour. </span></p>
<p><span style="font-family: Segoe UI; font-size: small;"><span style="color: #000000;">Scoping Step 1:</span> I created a new site collection in the problematic web application and checked what the performance is like. It was fast and we never experienced any timeout errors. So the problem was specific to a particular site collection.</span></p>
<p><span style="font-family: Segoe UI; font-size: small;"><span style="color: #000000;">Scoping Step 2:</span> I looked about in the UI to see how different it is from the default SharePoint sites. I immediately realized that there were some customizations in place, mostly cosmetic. So that didn&rsquo;t look like a problem to me.</span></p>
<p><span style="font-family: Segoe UI; font-size: small;"><span style="color: #000000;">Scoping Step 3:</span> I needed some data while running into this problem to see what SQL queries and stored procedures are being called. Based on our possibilities listed above, I also wanted to see performance data from the web and SQL Servers. So I setup the SQL Server to capture a profiler trace with capturing data only from the PID of the IIS worker process hosting this web application. I also setup the web server to capture performance monitor log including all counters for the processor, process, thread, .NET CLR exceptions and Web Service counters. There is a reason for using these specific counters. These counters will provide me with the following information:</span></p>
<ul>
<li><span style="font-family: Segoe UI; font-size: small;">The process that is taking up CPU cycles.</span></li>
<li><span style="font-family: Segoe UI; font-size: small;">The overall processor usage.</span></li>
<li><span style="font-family: Segoe UI; font-size: small;">The thread that is taking the most CPU cycles</span></li>
<li><span style="font-family: Segoe UI; font-size: small;">Exceptions are expensive. .NET CLR Exceptions counter will give me information if there are too many exceptions occurring in the IIS worker process hosting this application.</span></li>
<li><span style="font-family: Segoe UI; font-size: small;">Web Service Counters will give me information about the load on the web server</span></li>
</ul>
<p><span style="font-family: Segoe UI; font-size: small;">Once I got this information, I quickly realized that with a single request, we had a processor usage in excess of 60% which was sustained and lasted well over 100 seconds. I then looked at the SQL Profiler traces. When I look at the SQL profiler traces, I am usually trying to figure out</span></p>
<ul>
<li><span style="font-family: Segoe UI; font-size: small;">If any particular query is taking up too much time to execute. (This can be figured out by using the Duration column)</span></li>
<li><span style="font-family: Segoe UI; font-size: small;">If there are queries that are invoked a lot of times</span></li>
</ul>
<p><span style="font-family: Segoe UI; font-size: small;">You can easily do this using the Organize Columns button in the Events Selection tab of the SQL profiler trace to group by either duration or ObjectName. Grouping by duration can quickly tell you the long running queries and grouping by ObjectName will give you the stored procedures invoked the most number of times. Here&rsquo;s a screenshot</span></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/sudeepg/WindowsLiveWriter/MOSS2007requesttimedoutbrowsingorduringa_8F50/organizecols_2.png" original-url="http://blogs.msdn.com/blogfiles/sudeepg/WindowsLiveWriter/MOSS2007requesttimedoutbrowsingorduringa_8F50/organizecols_2.png"><img style="display: inline; border: 0px;" title="organizecols" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/sudeepg/WindowsLiveWriter/MOSS2007requesttimedoutbrowsingorduringa_8F50/organizecols_thumb.png" original-url="http://blogs.msdn.com/blogfiles/sudeepg/WindowsLiveWriter/MOSS2007requesttimedoutbrowsingorduringa_8F50/organizecols_thumb.png" alt="organizecols" width="176" height="136" border="0" /></a></p>
<p><span style="font-family: Segoe UI; font-size: small;">Both of the above scenarios could result in performance problems. In this case, I had data like the following from the SQL Profiler trace after grouping by ObjectName column.</span></p>
<table style="width: 440px;" border="1" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td valign="top" width="296"><span style="font-size: small;"><strong><span style="color: #000000; font-family: Segoe UI;">Object Name</span></strong></span></td>
<td valign="top" width="142"><span style="font-size: small;"><strong><span style="color: #000000; font-family: Segoe UI;">Invocation Count</span></strong></span></td>
</tr>
<tr>
<td valign="top" width="296"><span style="font-family: Segoe UI; font-size: small;">fn_GetDirName</span></td>
<td valign="top" width="142"><span style="font-family: Segoe UI; font-size: small;">17103</span></td>
</tr>
<tr>
<td valign="top" width="296"><span style="font-family: Segoe UI; font-size: small;">fn_GetLeafName</span></td>
<td valign="top" width="142"><span style="font-family: Segoe UI; font-size: small;">17103</span></td>
</tr>
<tr>
<td valign="top" width="296"><span style="font-family: Segoe UI; font-size: small;">proc_SplitUrl</span></td>
<td valign="top" width="142"><span style="font-family: Segoe UI; font-size: small;">17103</span></td>
</tr>
<tr>
<td valign="top" width="296"><span style="font-family: Segoe UI; font-size: small;">fn_GetEffectiveSiteFlags</span></td>
<td valign="top" width="142"><span style="font-family: Segoe UI; font-size: small;">9691</span></td>
</tr>
<tr>
<td valign="top" width="296"><span style="font-family: Segoe UI; font-size: small;">proc_GetEventReceivers</span></td>
<td valign="top" width="142"><span style="font-family: Segoe UI; font-size: small;">7695</span></td>
</tr>
<tr>
<td valign="top" width="296"><span style="font-family: Segoe UI; font-size: small;">proc_GetTpWebMetaDataAndListMetaData</span></td>
<td valign="top" width="142"><span style="font-family: Segoe UI; font-size: small;">5732</span></td>
</tr>
<tr>
<td valign="top" width="296"><span style="font-family: Segoe UI; font-size: small;">proc_SecGetDomainGroupMapData</span></td>
<td valign="top" width="142"><span style="font-family: Segoe UI; font-size: small;">4876</span></td>
</tr>
<tr>
<td valign="top" width="296"><span style="font-family: Segoe UI; font-size: small;">fn_GetSiteLogoDescription</span></td>
<td valign="top" width="142"><span style="font-family: Segoe UI; font-size: small;">4825</span></td>
</tr>
<tr>
<td valign="top" width="296"><span style="font-family: Segoe UI; font-size: small;">fn_GetSiteLogoUrl</span></td>
<td valign="top" width="142"><span style="font-family: Segoe UI; font-size: small;">4825</span></td>
</tr>
<tr>
<td valign="top" width="296"><span style="font-family: Segoe UI; font-size: small;">proc_ReturnTpWebMetaData</span></td>
<td valign="top" width="142"><span style="font-family: Segoe UI; font-size: small;">4825</span></td>
</tr>
<tr>
<td valign="top" width="296"><span style="font-family: Segoe UI; font-size: small;">proc_GetListMetaData</span></td>
<td valign="top" width="142"><span style="font-family: Segoe UI; font-size: small;">4537</span></td>
</tr>
<tr>
<td valign="top" width="296"><span style="font-family: Segoe UI; font-size: small;">proc_GetUniqueScopesInList</span></td>
<td valign="top" width="142"><span style="font-family: Segoe UI; font-size: small;">4537</span></td>
</tr>
</tbody>
</table>
<p><span style="font-family: Segoe UI; font-size: small;">Needless to say there is a pattern in which these stored procedures are being called. For example <strong><span style="color: #000000;">proc_SplitUrl</span></strong> invokes <strong><span style="color: #000000;">fn_GetLeafName</span></strong> and <strong><span style="color: #000000;">fn_GetDirName</span></strong> the same number of times. <strong><span style="color: #000000;">proc_SplitUrl</span></strong> is used by many stored procedures and let us see if we can match it up with something else over here that executes a large number of times... and we have <span style="color: #000000;"><strong>proc_UrlToWebUrlOutput</strong></span>. This in turn maps to <strong><span style="color: #000000;">proc_GetTpWebMetaDataAndListMetaData</span></strong>. Thus the chain of execution is as follows:</span></p>
<p><span style="font-family: Segoe UI; font-size: small;">proc_SplitUrl &gt; proc_UrlToWebUrlOutput &gt; proc_GetTpWebMetaDataAndListMetaData <br />&nbsp;&nbsp;&nbsp;&nbsp; |------------ fn_GetDirName <br />&nbsp;&nbsp;&nbsp;&nbsp; |------------ fn_GetLeafName</span></p>
<p><span style="font-family: Segoe UI; font-size: small;">If we lookup the documentation for these stored procedures on <a href="http://msdn.microsoft.com/en-us/library/dd302800(PROT.13).aspx">MSDN</a>, you will notice that these stored procedures are invoked anytime SharePoint needs to enumerate the metadata for the site/list for whatever activity it is doing. The information we have so far isn&rsquo;t enough to determine what the cause is. We know that some stored procedures are being invoked a very large number of times for a single request and the stored procedures being invoked are primarily to get metadata for the site/list. So this forms one part. The other unanswered part is &ndash; What user activity is causing us to enumerate the metadata? We already know that the problem occurs on any type of activity. So are all activities enumerating metadata? </span></p>
<p><span style="font-family: Segoe UI; font-size: small;">Recollect that I also mentioned that my observations from perfmon collected from web servers shows sustained CPU utilization in excess of 60% for a single request. That is very bad. Imagine what could happen on a busy production server. I collected multiple hang dumps using Debugging tools for Windows to see what the thread(s) are doing? Maybe that has a direct relation on the SQL activity as well? Clearly, reviewing memory dumps require some advanced skill sets. There are many blogs out there that can get you started on managed debugging. <a href="http://blogs.msdn.com/tessw">Here&rsquo;s</a> a link to the most popular one. What I observed was quite interesting. All of the busy threads had a managed callstack where this portion was common:</span></p>
<p><span style="font-family: Courier New; font-size: small;">Microsoft.SharePoint.Publishing.CachedObjectFactory.CreateWebFromUrl(System.String) <br />Microsoft.SharePoint.Publishing.Navigation.SPNavigationSiteMapNode..ctor(Microsoft.SharePoint.Publishing.Navigation.PortalWebSiteMapNode, ... <br />Microsoft.SharePoint.Publishing.Navigation.SPNavigationSiteMapNode.CreateSPNavigationSiteMapNode <br />Microsoft.SharePoint.Publishing.Navigation.PortalWebSiteMapNode.ProcessSPNavigationNode(Microsoft.SharePoint.Navigation.SPNavigationNode, ... <br />Microsoft.SharePoint.Publishing.Navigation.PortalWebSiteMapNode.PopulateNavigationChildren(Microsoft.SharePoint.Publishing.NodeTypes) <br />Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapNode.GetNavigationChildren(Microsoft.SharePoint.Publishing.NodeTypes, <br />Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapNode.GetNavigationChildren(Microsoft.SharePoint.Publishing.NodeTypes) <br />Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider.GetChildNodes(Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapNode, ... <br />Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider.GetChildNodes(System.Web.SiteMapNode) <br />Microsoft.SharePoint.Publishing.Navigation.PortalHierarchicalEnumerable.System.Collections.IEnumerable.GetEnumerator() <br />System.Web.UI.WebControls.Menu.DataBindRecursive(System.Web.UI.WebControls.MenuItem, System.Web.UI.IHierarchicalEnumerable) <br />System.Web.UI.WebControls.Menu.DataBindRecursive(System.Web.UI.WebControls.MenuItem, System.Web.UI.IHierarchicalEnumerable) <br />System.Web.UI.WebControls.Menu.DataBindRecursive(System.Web.UI.WebControls.MenuItem, System.Web.UI.IHierarchicalEnumerable) <br />System.Web.UI.WebControls.Menu.DataBindRecursive(System.Web.UI.WebControls.MenuItem, System.Web.UI.IHierarchicalEnumerable) <br />System.Web.UI.WebControls.Menu.DataBindRecursive(System.Web.UI.WebControls.MenuItem, System.Web.UI.IHierarchicalEnumerable) <br />System.Web.UI.WebControls.Menu.DataBindItem(System.Web.UI.WebControls.MenuItem) <br />System.Web.UI.WebControls.Menu.PerformDataBinding() <br />System.Web.UI.WebControls.HierarchicalDataBoundControl.PerformSelect() <br />System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() <br />System.Web.UI.WebControls.Menu.EnsureDataBound() <br />System.Web.UI.WebControls.Menu.OnPreRender(System.EventArgs, Boolean) <br /><strong><span style="color: #000000;">Microsoft.SharePoint.WebControls.AspMenu.OnPreRender</span></strong>(System.EventArgs)</span></p>
<p><span style="font-family: Segoe UI; font-size: small;">From my domain knowledge of SharePoint and developer background, I immediately realized that all of this was being trigged by the use of a menu control. Check the highlighted portion above. </span></p>
<p><span style="font-family: Segoe UI; font-size: small;">OK, so there are umpteen menus in the UI. Which one are we talking about? I poked to find this information from the memory dump. The <strong>Microsoft.SharePoint.WebControls.AspMenu</strong> on the managed stack has a property named <span style="color: #000000;"><strong>_id</strong></span> that holds the name of the menu. When I dumped it out, the name of the menu was: <span style="color: #000000;"><strong>TopNavigationMenu</strong></span></span></p>
<p><span style="font-family: Segoe UI; font-size: small;"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/sudeepg/WindowsLiveWriter/MOSS2007requesttimedoutbrowsingorduringa_8F50/topmenu_2.png" original-url="http://blogs.msdn.com/blogfiles/sudeepg/WindowsLiveWriter/MOSS2007requesttimedoutbrowsingorduringa_8F50/topmenu_2.png"><img style="display: inline; border: 0px;" title="topmenu" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/sudeepg/WindowsLiveWriter/MOSS2007requesttimedoutbrowsingorduringa_8F50/topmenu_thumb.png" original-url="http://blogs.msdn.com/blogfiles/sudeepg/WindowsLiveWriter/MOSS2007requesttimedoutbrowsingorduringa_8F50/topmenu_thumb.png" alt="topmenu" width="437" height="65" border="0" /></a>&nbsp; </span></p>
<p><span style="font-family: Segoe UI; font-size: small;">So now, we are ready to put our story together backed up by data.</span></p>
<p><span style="font-family: Segoe UI; font-size: small;"><span style="color: #000000;">CONCLUSION:</span> While building the user interface for any request, we need to build the top navigation menu since it is part of every page. While doing so, we end up enumerating a lot of metadata for many different sites. We looked into the number of top level sites and sub sites. There were few top level sites and many child &amp; sub child sites. So why are we enumerating all of them? When I looked at the top menu, I found that just hovering over a menu item will throw open the list of sub sites and hovering over the sub menu will throw open the sub sites list for that site and so forth. In short, the nest level for showing the sub sites was more than 1 (which is the default). We figured that using SharePoint designer, a developer had changed the nest level to 4. Thus we end up enumerating the metadata for all of the sub sites &ndash; 4 levels deep, just so that we can use that data for security trimming.</span></p>
<p><span style="font-family: Segoe UI; font-size: small;">We turned off the &ldquo;Show subsites&rdquo; option using the top level site settings: <strong><span style="color: #000000;">Portal &gt; Site Settings &gt; Modify Navigation</span></strong></span></p>
<p><span style="font-size: small;"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/sudeepg/WindowsLiveWriter/MOSS2007requesttimedoutbrowsingorduringa_8F50/showsubs_2.png" original-url="http://blogs.msdn.com/blogfiles/sudeepg/WindowsLiveWriter/MOSS2007requesttimedoutbrowsingorduringa_8F50/showsubs_2.png"><img style="display: inline; border: 0px;" title="showsubs" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/sudeepg/WindowsLiveWriter/MOSS2007requesttimedoutbrowsingorduringa_8F50/showsubs_thumb.png" original-url="http://blogs.msdn.com/blogfiles/sudeepg/WindowsLiveWriter/MOSS2007requesttimedoutbrowsingorduringa_8F50/showsubs_thumb.png" alt="showsubs" width="105" height="62" border="0" /></a></span></p>
<p><span style="font-family: Segoe UI; font-size: small;">This immediately fixed the Request Timed out exception since we are no longer displaying the top level menu structure. So we proved our findings by making this change. The end resolution for this issue was to change the nest level of the top menu bar to the default of 1 or whatever value is appropriate for you without running into the Request Timed out exception.</span></p>
<p><span style="font-family: Segoe UI; font-size: small;">Many of you may be wondering&hellip; such a trivial thing created such a huge performance problem? Well, yeah. Think about what impact any customization (even the smallest change) can have. The developer wouldn&rsquo;t have noticed this in the beginning because the number of sites in the hierarchy may have been relative small. As the site structure grows, this quickly becomes a performance problem.</span></p>
<p><span style="font-family: Segoe UI; font-size: small;">The other scenarios that I am aware of and by the way, a very common one that we see in our support cases, are large lists that even our customers were not aware of existed in their environment. My first suggestion is to click on the <strong><span style="color: #000000;">View All Site Content</span></strong> link in the quick Launch bar and see if you can find any large lists using the <span style="color: #000000;"><strong>Items</strong></span> column. Keep in mind that there may still be large lists that are not visible here, such as hidden lists. How Microsoft engineers figure out large lists will probably be the next blog post. :)</span></p>
<p><span style="font-family: Segoe UI; font-size: small;">&nbsp;</span></p>]]></content:encoded>
    </item>
    <item>
      <title>MOSS Search error - The Search application is not available for this site</title>
      <link>https://docs.microsoft.com/archive/blogs/sudeepg/moss-search-error-the-search-application-is-not-available-for-this-site</link>
      <pubDate>Mon, 08 Mar 2010 20:10:57 GMT</pubDate>
      <dc:creator><![CDATA[sudeepg]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sudeepg/2010/03/08/moss-search-error-the-search-application-is-not-available-for-this-site/</guid>
      <description><![CDATA[I recently got a hardware upgrade and had setup up a new farm in a virtual environment using...]]></description>
      <content:encoded><![CDATA[<p><font size="2" face="Segoe UI">I recently got a hardware upgrade and had setup up a new farm in a virtual environment using Hyper-V, after which I ran into the following problem after configuring search and attempting to perform a search. </font></p>  <p><font size="2" face="Segoe UI"><font color="#ffff00">Scenario:</font> I created a new web application on port 100 with no host headers &amp; then a site collection based on collaboration portal. On one of my client machines, I had a HOSTS file entry named NorthWindWeb that mapped to my Web Front End server. Thus I would access the application as </font><a href="http://northwindweb:100"><font size="2" face="Segoe UI">http://northwindweb:100</font></a></p>  <p><font size="2" face="Segoe UI">Later, I uploaded some documents using the browser interface and ran a Full Crawl. The first thing I observed was that my crawling failed. I have written a separate blog post <a title="here" href="http://unknown" target="_blank">here</a> on how I went about troubleshooting the problem. Anyways, so after fixing the crawl issues, I observed a peculiar behaviour – In the Search Centre of the collaboration portal, if I click on Advanced Search, I’d get back the following error: The Search Application is not available for this site. </font></p>  <p><font size="2" face="Segoe UI">My first instincts are to look at the Event logs on the Web Front end. I check the event logs on the web front end because that is where my request is sent to. Nothing in there. As always, the first thing in any troubleshooting is Scoping the problem area. Scoping really helps narrow down on the problem area.</font></p>  <p><font size="2" face="Segoe UI">In this case, it had to be some sort of configuration problem since I can get back a page which says “search application is not available for this site”. I always say this – pay attention to the error message. Although many times errors can be misleading, there might still be some clues to begin with when you have nothing to start with. </font></p>  <p><font size="2" face="Segoe UI">So let me split the error - “The search application” “is not available” “for this site”. Hmmm.. for this site? Why? So does it work for other sites? I decided to use the default URL with which I created the web application to begin with – which was <a href="http://servername:100">http://servername:100</a>. I did so because when you create applications with a specific URL, I’d at least expect the system to get it configured properly using the defaults. So in this case I opened a new browser and navigated to <a href="http://servername:100">http://servername:100</a>, clicked on the search centre and then Advanced Search. Cool! I was able to browse to the page without errors and search worked as expected! Now I figure that there is something wrong with the URL that I am using – which is <a href="http://northwindweb:100">http://northwindweb:100</a>. What is wrong? I am able to browse perfectly!</font></p>  <p><font size="2" face="Segoe UI">So here’s where some domain knowledge can help you move forward. In Office SharePoint Server, the Alternate Access Mappings (AAM) has a huge significance. AAM plays a vital role in accessing content, especially shared services. If you find one URL works and another doesn’t in MOSS apps, think AAM. So my first instinct was – Is the URL that I am using configured in the alternate access mappings configuration for that web application? Turns out that I didn’t have it! Although my HOSTS file entry was routing the traffic to the web front end correctly, the MOSS system doesn’t recognize the incoming URL HOST value. It checks its database and does not find this site/URL information and therefore returns the error. It works with the server name because it created the AAMs when I created the web application.</font></p>  <p><font size="2" face="Segoe UI">So I am sure you all know the resolution by now. :)</font></p>  <p><font size="2" face="Segoe UI">1. Open Central Administration Site.</font></p>  <p><font size="2" face="Segoe UI">2. Select the Alternate Access Mapping for that web application.</font></p>  <p><font size="2" face="Segoe UI">3. Click on Edit Public URLs link.</font></p>  <p><font size="2" face="Segoe UI">4. In the Intranet text box, add the value <a href="http://northwindweb:100">http://northwindweb:100</a></font></p>  <p><font size="2" face="Segoe UI">5. Click OK and test.</font></p>]]></content:encoded>
    </item>
    <item>
      <title>CONTENT DEPLOYMENT – the remote server returned an error: (404) Not Found</title>
      <link>https://docs.microsoft.com/archive/blogs/sudeepg/content-deployment-the-remote-server-returned-an-error-404-not-found</link>
      <pubDate>Tue, 10 Nov 2009 20:51:40 GMT</pubDate>
      <dc:creator><![CDATA[sudeepg]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sudeepg/2009/11/10/content-deployment-the-remote-server-returned-an-error-404-not-found/</guid>
      <description><![CDATA[This is one of a series of blogs that I plan to write on troubleshooting content deployment issues....]]></description>
      <content:encoded><![CDATA[<p><font size="2" face="Segoe UI">This is one of a series of blogs that I plan to write on troubleshooting content deployment issues. Here’s a scenario</font></p>  <p><font size="2" face="Segoe UI">The destination farm is running on a Windows Server 2008 computer. When deploying to the destination, the content deployment fails with the following error:</font></p>  <p><font size="2" face="Segoe UI">The remote server returned an error: (404)</font></p>  <p><font size="2" face="Segoe UI">The first thing to remember is that any errors related to content deployment will be reported to the application event log. This is the default diagnostic logging setting for Content Deployment category. Any medium events will also be reported to the ULS logs. Therefore the first place to find out why the deployment is failing is to look at the Application event log of the export server.</font></p>  <p><font size="2" face="Segoe UI">In my case, here’s what I found from application event logs:</font></p>  <p><font color="#ff8000" size="2" face="Segoe UI">Failed to transfer files to destination server for Content Deployment job '80 - 500 Full Deployment'. Exception was: 'System.Net.WebException: The remote server returned an error: (404) Not Found. at System.Net.HttpWebRequest.GetResponse()      <br />at Microsoft.SharePoint.Publishing.Internal.Administration.HttpDataTransfer.UploadFile(String sourceFilePath, String postToUrl, String&amp; responseXml)       <br />at Microsoft.SharePoint.Publishing.Administration.ContentDeploymentJob.UploadFilesToRemoteServer(Guid remoteJobId, String adminPortUrl, ArrayList dataFiles)</font><font color="#ff8000" size="2" face="Segoe UI">      <br />at Microsoft.SharePoint.Publishing.Administration.ContentDeploymentJob.DoServerToServer()'</font></p>  <p>   <br /><font color="#ff8000" size="2" face="Segoe UI">Publishing: Content deployment job failed. Error: 'System.Net.WebException: The remote server returned an error: (404) Not Found.      <br />at System.Net.HttpWebRequest.GetResponse()       <br />at Microsoft.SharePoint.Publishing.Internal.Administration.HttpDataTransfer.UploadFile(String sourceFilePath, String postToUrl, String&amp; responseXml)       <br />at Microsoft.SharePoint.Publishing.Administration.ContentDeploymentJob.UploadFilesToRemoteServer(Guid remoteJobId, String adminPortUrl, ArrayList dataFiles)       <br />at Microsoft.SharePoint.Publishing.Administration.ContentDeploymentJob.DoServerToServer()       <br />at Microsoft.SharePoint.Publishing.Administration.ContentDeploymentJob.ExecuteJob()       <br />at Microsoft.SharePoint.Publishing.Administration.ContentDeploymentJob.Run(Boolean runAsynchronously)'       <br /></font></p>  <p><font color="#ff8000" size="2" face="Segoe UI">Publishing: Content deployment job failed. Error: 'System.Net.WebException: The remote server returned an error: (404) Not Found.      <br />at System.Net.HttpWebRequest.GetResponse()       <br />at Microsoft.SharePoint.Publishing.Internal.Administration.HttpDataTransfer.UploadFile(String sourceFilePath, String postToUrl, String&amp; responseXml)       <br />at Microsoft.SharePoint.Publishing.Administration.ContentDeploymentJob.UploadFilesToRemoteServer(Guid remoteJobId, String adminPortUrl, ArrayList dataFiles)       <br />at Microsoft.SharePoint.Publishing.Administration.ContentDeploymentJob.DoServerToServer()       <br />at Microsoft.SharePoint.Publishing.Administration.ContentDeploymentJob.ExecuteJob()       <br />at Microsoft.SharePoint.Publishing.Administration.ContentDeploymentJob.Run(Boolean runAsynchronously)       <br />at Microsoft.SharePoint.Publishing.Administration.ContentDeploymentJobDefinition.Execute(Guid targetInstanceId)'       <br /></font></p>  <p><font color="#ff8000" size="2" face="Segoe UI">The Execute method of job definition Microsoft.SharePoint.Publishing.Administration.ContentDeploymentJobDefinition (ID 70d6c4ef-bda5-4b5e-84a0-8c07e4ec3e42) threw an exception. More information is included below.</font></p>  <p><font size="2" face="Segoe UI">So as we can see, the Exception was - The remote server returned an error: (404) Not Found. Where do we start troubleshooting? We should start by understanding what status code 404 means and what type of operation we were in when this failure occurred. The second part of the question can be easily answered by looking at the above callstack. At the top of the callstack is <font color="#ff8000">HttpDataTransfer.UploadFile()</font> method. This means were were uploading a file to the target farm when the error occurred.</font></p>  <p><font size="2" face="Segoe UI">Info: Content deployment transfers contents to the destination by splitting them into multiple cab files and then uploading those files to a page in the target central administration site. Thus if we open the IIS log for the target central administration website, we should see the failure and more specific information about HTTP 404 response. Here’s what I found</font></p>  <p><font color="#ffff00" size="2" face="Segoe UI">POST /_admin/Content+Deployment/DeploymentUpload.aspx filename=%22ExportedFiles1.cab%22&amp;remoteJobId=%223c392e22-67d9-46cb-b6c3-225cade93479%22<font color="#ffffff"> 81 -</font> 404 13<font color="#ffffff"> 0 20</font></font></p>  <p><font size="2" face="Segoe UI">The salient parts in this IIS log entry are highlighted in yellow colour. The value 13 right after 404 is a sub-status code that gives more information about the type of failure. The IIS status codes and their meanings can be found </font><a title="IIS Status codes on Microsoft KB" href="http://support.microsoft.com/kb/943891" target="_blank"><font color="#ff8000" size="2" face="Segoe UI">here</font></a></p>  <p><font size="2" face="Segoe UI">So from this article, we end up with: 404.13 - Content length too large</font></p>  <p><font size="2" face="Segoe UI">So what is the size of the file ExportedFiles1.cab that we are trying to upload to the destination? We can find this out easily by opening the path to the temporary files on the source (Export Server) as configured in the content deployment settings within Central Administration. By default, this path is <font color="#ffff00">%windir%\TEMP\ContentDeployment.</font> Now there is a catch here. By default, content deployment removes the temporary files. You must first configure content deployment to keep the temporary files in the event of a failure. This setting cannot be changed from the User Interface. The correct procedure to change the setting is to use STSADM command line</font></p>  <p><font color="#ff8000" size="2" face="Segoe UI">STSADM.EXE -o editcontentdeploymentpath -pathname &quot;MyPath&quot; -keeptemporaryfiles Failure</font></p>  <p><font size="2" face="Segoe UI">After making this change in setting, on the next run, the temporary files will not be removed and you can easily find out the size of the file it was trying to upload by opening this folder. In my case, it turned out to be 61 MB. So why can’t I upload a file of this size? It was possible to do this in Windows Server 2003! Also, who is throwing this error? These are the next set of questions we need to find answers to.</font></p>  <p><font size="2" face="Segoe UI">As I just mentioned, it is very important to figure out who is throwing this error – Is it IIS or Is it SharePoint? We know this behaviour was not present in Windows 2003 and therefore a likely chance that IIS 7, that ships with Windows 2008 is a cause here. Also, a little bit of IIS domain knowledge will help you very easily conclude where the problem is. If you do not have the domain knowledge, you can still troubleshoot using the Failed Request Tracing feature of IIS to pin point where exactly the failure occurred. Failed request tracing is a different subject altogether and if you are interested to know how to use this feature, here’s the <a title="Failed Request tracing in IIS 7" href="http://learn.iis.net/page.aspx/266/troubleshooting-failed-requests-using-tracing-in-iis-70/" target="_blank">official documentation</a>. </font></p>  <p><font size="2" face="Segoe UI">So for folks without IIS domain knowledge, throw in the returned error code and associated message from the KB above into a search engine of your choice and you will get several articles about what setting you need to change to fix this. I’d suggest always using official documentation. I found <a href="http://learn.iis.net/page.aspx/143/use-request-filtering/" target="_blank">this</a>.</font></p>  <p><font size="2" face="Segoe UI">For myself, I know from experience that IIS 7 has a change where by we limit the max size of a request. The feature implements something like what URLScan did for us in the previous versions. Here is the documentation on <a title="requestLimit on IIS 7 @ www.iis.net" href="http://www.iis.net/ConfigReference/system.webServer/security/requestFiltering/requestLimits" target="_blank">requestLimits</a> on IIS 7. So reading through, I can see that this module in IIS 7 can return 404.13 status and the size of request allowed is specified by maxAllowedContentLength attribute with a default value of 30000000 bytes, which is approximately 28.6MB. </font></p>  <p><font size="2" face="Segoe UI">So now we have identified why the server returned this status code and the solution is to simply increase this limit. Here’s how to do that using the new command line feature of IIS 7</font></p>  <p><font color="#ff8000" size="2" face="Segoe UI"><font color="#ffffff">On the destination farm, Open a command prompt and switch to C:\Windows\System32\inetsrv folder        <br />Execute: </font>appcmd set config &quot;SharePoint Central Administration v3&quot; -section:system.webserver/security/requestFiltering -requestLimits.MaxAllowedContentLength:524288000</font></p>  <p><font size="2" face="Segoe UI">&#160;</font></p>]]></content:encoded>
    </item>
    <item>
      <title>Provisioning shared services fails with user cannot be found error</title>
      <link>https://docs.microsoft.com/archive/blogs/sudeepg/provisioning-shared-services-fails-with-user-cannot-be-found-error</link>
      <pubDate>Tue, 10 Nov 2009 05:58:44 GMT</pubDate>
      <dc:creator><![CDATA[sudeepg]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sudeepg/2009/11/10/provisioning-shared-services-fails-with-user-cannot-be-found-error/</guid>
      <description><![CDATA[I was recently rebuilding one of my farms when I ran into the problem I describe below.   I logged...]]></description>
      <content:encoded><![CDATA[<p><font size="2" face="Segoe UI">I was recently rebuilding one of my farms when I ran into the problem I describe below. </font></p>  <p><font size="2" face="Segoe UI">I logged onto the machine using my domain account. Then created local user accounts for use with my standalone farm on this machine and then ran SharePoint Post Installation Configuration Wizard. After creating a new farm with a new configuration database, it also created the SharePoint Central Administration site for me automatically. I then attempted to provision my Shared Services Provider and guess what I run into? After several minutes, I get a page with the following error:</font></p>  <p><font size="2" face="Segoe UI">Provisioning for Shared Services Provider 'My SSP' has failed and will be retried.&#160; Reason: User cannot be found.&#160; </font></p>  <p><font size="2" face="Segoe UI">The error message is very odd! It doesn’t tell us which user it cannot find and what it wants to do. So I turn on our friendly diagnostic logging from the Operations tab in SharePoint Central Administration to get a verbose output of the actions. What I ended up finding was amusing. Although I didn’t completely understand why it works this way, here’s what I found in the ULS logs. I am including only the data in the message column for brevity:</font></p>  <p><font size="2" face="Segoe UI">Retrieved central administration site '</font><a href="http://CASite:81'"><font color="#ffffff" size="2" face="Segoe UI">http://CASite:81'</font></a><font size="2" face="Segoe UI">.&#160;&#160;&#160;&#160; <br />Central administration site owner is 'Domain\UserName'.&#160;&#160;&#160;&#160; <br />Creating shared services administration site 'My SSP'.&#160;&#160;&#160;&#160; <br />Creating site ssp/admin in content database MySite_Content_82&#160;&#160;&#160;&#160; <br />Error in resolving user 'Domain\UserName' : </font></p>  <h1><font color="#ffff00" size="2" face="Segoe UI"></font></h1>  <h1><font color="#ffff00" size="2" face="Segoe UI">System.ComponentModel.Win32Exception: Unable to contact the global catalog server&#160;&#160;&#160;&#160; </font></h1>  <h1><font color="#ffff00" size="2" face="Segoe UI">at Microsoft.SharePoint.Utilities.SPActiveDirectoryDomain.GetDirectorySearcher()&#160;&#160;&#160;&#160; </font></h1>  <h1><font color="#ffff00" size="2" face="Segoe UI">at Microsoft.SharePoint.WebControls.PeopleEditor.SearchFromGC(SPActiveDirectoryDomain domain, String strFilter, String[] rgstrProp, Int32 nTimeout, Int32 nSizeLimit, SPUserCollection spUsers, ArrayList&amp; rgResults)&#160;&#160;&#160;&#160; </font></h1>  <h1><font color="#ffff00" size="2" face="Segoe UI">at Microsoft.SharePoint.Utilities.SPUserUtility.ResolveAgainstAD(String input, Boolean inputIsEmailOnly, SPActiveDirectoryDomain globalCatalog, SPPrincipalType scopes, SPUserCollection usersContainer, TimeSpan searchTimeout, String customFilter)&#160;&#160;&#160;&#160; </font></h1>  <h1><font size="2"><font face="Segoe UI"><font color="#ffff00">at Microsoft.SharePoint.Utilities.SPActiveDirectoryPrincipalResolver.ResolvePrincipal(String input, Boolean inputIsEm...</font>&#160;&#160;&#160;&#160; </font></font></h1>  <h1><font size="2" face="Segoe UI"></font></h1>  <h1><font color="#ffff00" size="2" face="Segoe UI">Microsoft.SharePoint.SPException: User cannot be found.&#160;&#160;&#160;&#160; </font></h1>  <h1><font color="#ffff00" size="2" face="Segoe UI">at Microsoft.SharePoint.Administration.SPSiteCollection.Add(SPContentDatabase database, String siteUrl, String title, String description, UInt32 nLCID, String webTemplate, String ownerLogin, String ownerName, String ownerEmail, String secondaryContactLogin, String secondaryContactName, String secondaryContactEmail, String quotaTemplate, String sscRootWebUrl, Boolean useHostHeaderAsSiteName)&#160;&#160;&#160;&#160; </font></h1>  <h1><font color="#ffff00" size="2" face="Segoe UI">at Microsoft.SharePoint.Administration.SPSiteCollection.Add(String siteUrl, String title, String description, UInt32 nLCID, String webTemplate, String ownerLogin, String ownerName, String ownerEmail, String secondaryContactLogin, String secondaryContactName, String secondaryContactEmail, Boolean useHostHeaderAsSiteName)&#160;&#160;&#160;&#160; </font></h1>  <h1><font size="2" face="Segoe UI"><font color="#ffff00">at Microsoft.Sh...</font>&#160;&#160;&#160;&#160; </font></h1>  <p><font size="2" face="Segoe UI">So it turns out that while provisioning the Shared Services, there is a lookup on who the Site collection administrator is for the Central Administration Website. This makes sense because it needs to update all these settings for SSP database. While provisioning the Central Administration site, it used my domain account for the site collection administrator. Now, during the provisioning of the Shared Services, it was trying to resolve the account specified in the Central Administration site’s site collection administrators list, but failed to do so as it could not contact the global catalog server, resulting in this behaviour.</font></p>  <p><font size="2" face="Segoe UI">Resolution: </font></p>  <ol>   <li><font size="2" face="Segoe UI">Open Central Administration and then click on Site Actions in top right corner, then site settings.</font></li>    <li><font size="2" face="Segoe UI">Under users and permissions column, click on Site Collection Administrators.</font></li>    <li><font size="2" face="Segoe UI">Removed my domain account from here and added the local Administrator account which I wanted to use for administering the local farm.</font></li>    <li><font size="2" face="Segoe UI">Click OK and wait for the Shared Services to be provisioned automatically (SharePoint will periodically re-attempt a failed provisioning of SSP)</font></li> </ol>  <p><font size="2" face="Segoe UI">&#160;</font></p>]]></content:encoded>
    </item>
    <item>
      <title>access denied while trying to save to favorites</title>
      <link>https://docs.microsoft.com/archive/blogs/sudeepg/access-denied-while-trying-to-save-to-favorites</link>
      <pubDate>Thu, 29 Oct 2009 22:15:09 GMT</pubDate>
      <dc:creator><![CDATA[sudeepg]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sudeepg/2009/10/29/access-denied-while-trying-to-save-to-favorites/</guid>
      <description><![CDATA[I use the “Add to Favorites” feature in Internet Explorer a lot. After moving to Windows Vista, I...]]></description>
      <content:encoded><![CDATA[<p><font size="2" face="Segoe UI">I use the “Add to Favorites” feature in Internet Explorer a lot. After moving to Windows Vista, I ran into a problem where I’d get an Access Denied error, anytime I attempted to create a folder within the Favourites. I was curious to find out why I can no longer create folders in my favourites. So I decided to begin with basics. I checked the permissions in my User Profile\Favourites folder and found I had Full Control. I also attempted to create a folder using the file system which was successful. Now comes our tools to figure out why Iexplore process cannot create the folder on my behalf. To figure this out, I used </font><font size="2" face="Segoe UI">Process Monitor. I captured a process monitor output by filtering on iexplore.exe process and here’s what I found:</font></p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/sudeepg/WindowsLiveWriter/accessdeniedwhiletryingtosavetofavorites_971C/Fav_4.png" original-url="http://blogs.msdn.com/blogfiles/sudeepg/WindowsLiveWriter/accessdeniedwhiletryingtosavetofavorites_971C/Fav_4.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Fav" border="0" alt="Fav" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/sudeepg/WindowsLiveWriter/accessdeniedwhiletryingtosavetofavorites_971C/Fav_thumb_1.png" original-url="http://blogs.msdn.com/blogfiles/sudeepg/WindowsLiveWriter/accessdeniedwhiletryingtosavetofavorites_971C/Fav_thumb_1.png" width="509" height="583" /></a> </p>  <p><font size="2" face="Segoe UI">As you can see from the event captured, the iexplore.exe process is running with Low Integrity level. Integrity levels are a new feature within Windows Vista and upwards. So if a process has a low integrity level, irrespective of whether the identity is part of local administrators group, operations like these on file system will still fail. Understandably, this is a security feature that I like and dislike at the same time. I like it because it prevents any website that I browse to from running code on my system that may be harmful. On the other hand I cannot save links to my favourites, which is not good either. </font></p>  <p><font size="2" face="Segoe UI">Weighing both options, I think I will stick to running iexplore process in low integrity level and save the links manually. The other option is to run iexplore.exe process as Administrator by right clicking on the shortcut and selecting “Run as Administrator”. </font></p>  <p><font color="#ffff00" size="2" face="Segoe UI">CAUTION: I do not recommend you do this at all because this runs the browser with elevated privileges and therefore it will be very easy for any malicious code to infect the machine.</font></p>]]></content:encoded>
    </item>
    <item>
      <title>people picker &amp;amp; user accounts resolution in domainS FROM different forestS</title>
      <link>https://docs.microsoft.com/archive/blogs/sudeepg/people-picker-amp-user-accounts-resolution-in-domains-from-different-forests</link>
      <pubDate>Tue, 06 Oct 2009 07:58:40 GMT</pubDate>
      <dc:creator><![CDATA[sudeepg]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sudeepg/2009/10/06/people-picker-amp-user-accounts-resolution-in-domains-from-different-forests/</guid>
      <description><![CDATA[Ever run into a situation where the people picker in SharePoint will fail to resolve usernames...]]></description>
      <content:encoded><![CDATA[<font size="2" face="Segoe UI"></font>  <p><font size="2" face="Segoe UI">Ever run into a situation where the people picker in SharePoint will fail to resolve usernames that are within a domain in a totally different forest? Assuming the trust relationships are setup properly? Well think again. Here is a quick check list:</font></p>  <ul>   <li><font size="2" face="Segoe UI">Ensure your people picker property is configured correctly in SharePoint. </font></li>    <li><font size="2" face="Segoe UI">Configure your trust relationships properly. </font></li>    <li><font size="2" face="Segoe UI">Ensure the ports required for inter server communication is opened. A list can be found &lt;insert hyperlink&gt;</font> </li>    <li><font size="2" face="Segoe UI">Ensure your DNS configuration is correct. This is specifically important because the web server will need to locate the Global Catalog Servers and the Domain Controllers in the source &amp; target domains. </font></li> </ul>  <p><font size="2" face="Segoe UI">Each of the above points is in itself a big task. A failure in any one of these dependent components will cause people picker to fail. To allow SharePoint to query AD of a different domain, you need to configure it to use a specific account from the trusted domain. Here’s how you do that using STSADM command line</font></p>  <ul>   <li><font size="2" face="Segoe UI">stsadm –o setapppassword –password ********        <br />stsadm –o setproperty –pn peoplepicker-searchadforests –pv “domain:<font color="#ffff00">FQDN of trusted domain</font>,<font color="#ffff00">Account in trusted domain</font>,<font color="#ffff00">Password”</font> –url URL of App</font>       <br /><font size="2" face="Segoe UI">Recycle AppPool for changes to take effect (Optional)</font> </li> </ul>  <p><font size="2" face="Segoe UI">Alright. So now we know the basic check lists, we need to know how this works normally before you can troubleshoot any issues. In other words, unless you know what is normal, you cannot spot the abnormal?</font></p>  <p><font size="2" face="Segoe UI">Here’s a description of how PeoplePicker works in SharePoint. </font></p>  <p><font size="2" face="Segoe UI">Web server contacts one of the DCs in its domain and requests a SID lookup using the Windows API </font><a href="http://msdn.microsoft.com/en-us/library/cc234492(PROT.10).aspx" target="_blank"><font size="2" face="Segoe UI">LsarLookupNames4</font></a><font size="2" face="Segoe UI">. The <font color="#ff8000">LsarLookupNames4</font> method translates a batch of security principal names to their SID form. This traffic is encrypted and the Web server and domain controller talks via RPC. The RPC end point mapper is a UUID: <font color="#ffff00">E1AF8308-5D1F-11C9-91A4-08002B14A0FA</font>. Now because this is initiated from LSASS, the LSARpc identifier is <font color="#ffff00">12345778-1234-ABCD-EF00-0123456789AB</font>. You should see both of these in a network trace. A successful request/response indicates that that RPC communication is successful.</font></p>  <p><font size="2" face="Segoe UI">So with <font color="#ff8000">LsarLookupNames4</font> API, we should get a SID. The next thing that happens is an LDAP query trying to lookup this SID and see if the name matches with what the user entered. To perform this, you need to have Kerberos traffic flowing properly. If Kerberos is working properly, you should also see that traffic just before the LDAP query with the username that you configured within SharePoint. After Kerberos authentication, SharePoint server then sends </font><font size="2" face="Segoe UI">the LDAP query to one of the DCs in the trusted domains and does a search - something like:</font></p>  <p><font color="#ffff00" size="2" face="Segoe UI">LDAP:Search Request, MessageID: 26, BaseObject: DC=SharePoint,DC=com, SearchScope: WholeSubtree, SearchAlias: neverDerefAliases      <br />LDAP:Search Result Entry, MessageID: 26, Status: Success</font></p>  <p><font size="2" face="Segoe UI">A filter is also passed based to indicate search based on the SID. Filter: <font color="#ffff00">(&amp;(objectSID=))</font></font></p>  <p><font size="2" face="Segoe UI">The search result contains the properties requested for the user including the user’s SID. If everything matches, then we are done and the user’s full name should be displayed. </font></p>  <p><font size="2" face="Segoe UI">So that’s how it is “expected” to work. But most of the times when a support engineer is looking at the problem, he will not find the above traffic. Instead he is looking at the traffic in the broken scenario and there may be several reasons why the feature is not able to find the user. For eg:</font></p>  <ul>   <li><font size="2" face="Segoe UI">What if the trust relationship is not setup properly? Can we verify that using a network trace? Is it possible?</font> </li>    <li><font size="2" face="Segoe UI">What if the MSRPC is broken? Can we determine that using a network trace?</font> </li>    <li><font size="2" face="Segoe UI">What if the DNS entries are not setup properly? Can you determine that using the network trace?</font> </li> </ul>  <p><font size="2" face="Segoe UI">So well, the answer is “depends”. A lot of times you can make a good conclusion depending on what you see in the network trace if you have domain specific knowledge. </font></p>  <ul>   <li><font size="2" face="Segoe UI">If you never see the MSRPC bind requests getting a success response, chances are that the trust is not setup properly.</font> </li>    <li><font size="2" face="Segoe UI">If you do not see Kerberos traffic or connecting with the username specified in SharePoint, then your SharePoint configuration is probably not correct.</font> </li>    <li><font size="2" face="Segoe UI">If you see DNS related errors in the network trace (filter by DNS traffic), then your DNS is probably broken and needs to be fixed. </font></li> </ul>  <p><font size="2" face="Segoe UI">Obviously, what needs to be fixed depends on what his broken.</font> <font size="2" face="Segoe UI">No matter what works and what does not, at the end of the day, if you performed a Check Name operation within People Picker, we must match the user with a SID. To do that, SharePoint goes to great lengths. SharePoint will attempt a query based on Person or Group and also perform a wild card search. Here’s an example of filters used that you may see in the network trace for LDAP queries:</font></p>  <p><font size="2" face="Segoe UI">First Attempt: </font></p>  <p><font color="#ffff00" size="2" face="Segoe UI">filter: (objectCategory=person)      <br />filter: (objectClass=user)       <br />filter: (!(BIT_AND: (userAccountControl)&amp;2))       <br />filter: (|(name=Sharepoint\Skumar)(displayName=Sharepoint\Skumar)(cn=Sharepoint\Skumar)(mail=Sharepoint\Skumar)(samAccountName=Sharepoint\Skumar)(proxyAddresses=SMTP:Sharepoint\Skumar)(proxyAddresses=sip:Sharepoint\Skumar)) </font></p>  <p><font size="2" face="Segoe UI"><font color="#ffff00">filter: (objectCategory=group)        <br />filter: (BIT_AND: (groupType)&amp;2147483648)         <br />filter: (|(name=Sharepoint\Skumar)(displayName=Sharepoint\Skumar)(cn=Sharepoint\Skumar)(samAccountName=Sharepoint\Skumar))</font> </font></p>  <p><font size="2" face="Segoe UI">Result: None </font></p>  <p><font size="2" face="Segoe UI"></font></p>  <p><font size="2" face="Segoe UI">Second Attempt</font></p>  <p><font color="#ffff00" size="2" face="Segoe UI">filter: (objectCategory=person)      <br />filter: (objectClass=user)       <br />filter: (!(BIT_AND: (userAccountControl)&amp;2))       <br />filter: (|(name=Sharepoint\Skumar*)(displayName=Sharepoint\Skumar*)(cn=Sharepoint\Skumar*)(mail=Sharepoint\Skumar*)(sn=Sharepoint\Skumar*)(SamAccountName=Skumar*)(proxyAddresses=SMTP:Sharepoint\Skumar)(proxyAddresses=sip:Sharepoint\Skumar)) </font></p>  <p><font color="#ffff00" size="2" face="Segoe UI">filter: (objectCategory=group)      <br />filter: (BIT_AND: (groupType)&amp;2147483648)       <br />filter: (|(name=Sharepoint\Skumar*)(displayname=Sharepoint\Skumar*)(cn=Sharepoint\Skumar*)(SamAccountName=Skumar*))</font></p>  <p><font size="2" face="Segoe UI">Chances are that you may get back a response with a wild card search – as in the second case on my machine, because an OR search on <font color="#ffff00">SamAccountName=SKumar*</font> found a record but not with <font color="#ffff00">SamAccountName=SharePoint\SKumar</font> as in the first case. However, what happens right after that is, the system will pick the SID from the response (if any) and attempt a match with the SID. If that fails, Check Name operation will throw an error that it could not find the user. So the key to getting that to work is ensure that we can perform a SID lookup successfully. </font></p>  <p><font size="2" face="Segoe UI">So what tools are there to check if we can resolve the SIDs? </font></p>  <p><font size="2" face="Segoe UI">Microsoft Support uses from <a href="http://technet.microsoft.com/en-us/sysinternals/bb897417.aspx" target="_blank">PSGetSID</a> from SysInternals. It is one of the tools you can use to verify if the SID lookup is working properly in your environment. &amp; it is really easy to use. From a command line, run: PSGetSid &lt;domain\username&gt;. </font></p>  <p><font size="2" face="Segoe UI">If this tool fails to get the SID, ignore the SharePoint part and focus on fixing your environment first.&#160; </font></p>]]></content:encoded>
    </item>
    <item>
      <title>Send to… Other Location feature, MOSS &amp;amp; Office clients</title>
      <link>https://docs.microsoft.com/archive/blogs/sudeepg/send-to-other-location-feature-moss-amp-office-clients</link>
      <pubDate>Tue, 29 Sep 2009 06:09:40 GMT</pubDate>
      <dc:creator><![CDATA[sudeepg]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sudeepg/2009/09/29/send-to-other-location-feature-moss-amp-office-clients/</guid>
      <description><![CDATA[Have you used this feature before? I see a lot of people on the internet using this feature and...]]></description>
      <content:encoded><![CDATA[<p><font size="2" face="Segoe UI">Have you used this feature before? I see a lot of people on the internet using this feature and there are a couple of scenarios in which this feature won’t work “as expected”. I recently had a chance to spend some time on this and here are my observations after hours of testing.</font></p>  <p><font size="2" face="Segoe UI">If you attempt copying a document from one document library to another and the source and target libraries are in different web applications, then this feature won’t work with Office 2003 clients and MOSS 2007. My guess is that this behaviour occurs because, when Office 2003 was released, it wasn’t built to support features that MOSS 2007 provides. MOSS 2007 was released 4 years later!</font></p>  <p><font size="2" face="Segoe UI">This feature will work with Office 2007 clients, though. However if you are copying from one library to another which are located in different site collections AND there does not exist a root site collection at the target, then this feature won’t work. If you see these symptoms, creating an empty root site collection should resolve the problem. It appears to me that it may have something to do with not being able to find the path to the child if the root site collection does not exist.</font></p>  <p><font size="2" face="Segoe UI">The way the Send to... Other location works is by using a ActiveX Control (<font color="#ffff00">Multiple Document Upload Control</font>) installed with Microsoft Office 2007. After you provide the destination URL (BTW, the destination URL must end with the library name and not the view name such as AllForms.aspx) and click OK, the Jscript on the web page invokes this control with a call to new ActiveXObject(&quot;STSUpld.CopyCtl&quot;);. To successfully instantiate the control, the following registry keys must be present.</font></p>  <ul>   <li><font size="2" face="Segoe UI">HKCR\STSUpld.CopyCtl</font></li>    <li><font size="2" face="Segoe UI">HKCR\STSUpld.CopyCtl.CLSID\(Default)</font></li>    <li><font size="2" face="Segoe UI">HKCR\STSUpld.CopyCtl.CLSID</font></li> </ul> <font size="2" face="Segoe UI">The control itself is located in the DLL present @ C:\Program Files\Microsoft Office\Office12\STSUPLD.DLL</font>  <p><font size="2" face="Segoe UI">When instantiated, this control contacts a web service on the SharePoint server to copy the contents from source to destination. It first makes a request to the source to get the document and its properties and then POSTs the data to the target location. Now, if the Multiple Upload control cannot be loaded for some reason, SharePoint will attempt to perform this operation via server side by sending a POST to CopyResults.aspx. This is what you see in the browser address bar. Now, the CopyResults.aspx page is capable of copying of documents only if the source and destination are in the same web application. The functionality appears to be by design – In other words, the page restricts copying across application boundaries. The API that causes this behaviour is also documented on MSDN.</font></p>  <p><font size="2" face="Segoe UI"><a title="ValidateDomainCompatibility Method" href="http://msdn.microsoft.com/en-us/library/aa979660.aspx" target="_blank">ValidateDomainCompatibility Method</a></font></p>  <p><font size="2" face="Segoe UI">Also, the posting and responses from the Program Manager @ the SharePoint Designer Team blog has mentioned that calling Cross applications is not allowed. Here’s the <a title="Sharepoint designer team blog" href="http://blogs.msdn.com/sharepointdesigner/archive/2007/04/24/spdatasource-and-rollups-with-the-data-view.aspx" rel="tag" target="_blank">link</a>. FYI, there isn’t a setting to change this behaviour. This is probably something that the development team knows about and may fix in the later versions of MOSS, hopefully.</font></p>  <p><font size="2" face="Segoe UI">When application domain boundaries need to be crossed, only the web service - Copy.asmx works because it completely extracts all the contents (encrypted of course!) and the properties of the document before posting it to the target document library. I am still not sure why this functionality cannot work from server side code though; but that appears to be what is going on.</font></p>  <p><font size="2" face="Segoe UI">Coming back to problems instantiating the Multiple Upload control installed with Office 2007 clients, the best way to fix it will be to run a repair installation of Microsoft Office because the DLL in question is not something you can register using regsvr command. Also, when running the Office Setup, ensure Windows SharePoint Services support component is selected.</font></p>  <p><font size="2" face="Segoe UI">I hope the information shared above was helpful to people who have/are running into this behaviour. </font></p>  <p>&#160;</p>  <p><font size="2" face="Segoe UI">&#160;</font></p>]]></content:encoded>
    </item>
    <item>
      <title>Sharepoint – custom solution deployment failure</title>
      <link>https://docs.microsoft.com/archive/blogs/sudeepg/sharepoint-custom-solution-deployment-failure</link>
      <pubDate>Tue, 15 Sep 2009 04:04:14 GMT</pubDate>
      <dc:creator><![CDATA[sudeepg]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sudeepg/2009/09/15/sharepoint-custom-solution-deployment-failure/</guid>
      <description><![CDATA[I recently ran into a problem where custom SharePoint solutions will randomly fail to deploy on any...]]></description>
      <content:encoded><![CDATA[<p><font size="2" face="Segoe UI">I recently ran into a problem where custom SharePoint solutions will randomly fail to deploy on any of the web servers in the farm. The nature of the problem was hard to debug. The failure can occur on any web server and on any resource file being deployed or when the solution is being retracted. The error message would be as follows:</font></p>  <p><font color="#ff0000" size="2" face="Segoe UI">&quot;Copying of this file failed. This operation uses the SharePoint Administration service (spadmin), which could not be contacted. If the service is stopped or disabled,&#160; start it and try the operation again.&quot;</font></p>  <p><font size="2" face="Segoe UI">So it turns out that the internal exception that causes this problem is:</font></p>  <p><font color="#ffff00" size="2" face="Segoe UI"><font color="#ff0000">Failed to connect to an IPC Port: The system cannot find the file specified.</font>&#160; </font></p>  <p><font size="2" face="Segoe UI">There is a new hotfix available for this which updates a .NET Framework DLL, which resolves this issue. The specific KB article that talks about this is</font></p>  <p><a href="http://support.microsoft.com/kb/971521" target="_blank"><font size="2" face="Segoe UI">A System.Runtime.Remoting.RemotingException exception is thrown when you deploy a SharePoint solution on a SharePoint Web server that is running the .NET Framework 2.0 SP2</font></a></p>  <p><font size="2" face="Segoe UI">FYI: You need to have .NET Framework 2.0 Service Pack 2 installed before applying this fix.</font></p>  <p><font size="2" face="Segoe UI">If you want to debug this and confirm that the internal exception is actually the one noted above, there are 2 ways to use this.</font></p>  <p><font size="2" face="Segoe UI">Easy way: Look at the application event logs to see if this exception is logged.</font></p>  <p><font size="2" face="Segoe UI">Hard way: <font color="#800000">!!! Do not try this in Production !!!</font> Read on…</font></p>  <ol>   <li><font size="2" face="Segoe UI">Download and install </font><a href="http://www.microsoft.com/whdc/devtools/debugging/default.mspx" target="_blank"><font size="2" face="Segoe UI">Debugging tools for Windows</font></a><font size="2" face="Segoe UI"> for the platform on which you are running.</font> </li>    <li><font size="2" face="Segoe UI">Using ADPlus, log all first chance .NET CLR exceptions. </font></li>    <li><font size="2" face="Segoe UI">Note down the IIS worker process (w3wp.exe) PID corresponding to your app using using task manager</font> </li>    <li><font size="2" face="Segoe UI">Save the below script to Debugging tools for windows folder as LogExceptions.cfg </font></li>    <li><font size="2" face="Segoe UI">Execute the command as: CScript adplus.vbs –p &lt;PID&gt; –c LogException.cfg</font> </li>    <li><font size="2" face="Segoe UI">Reproduce the problem.</font> </li>    <li><font size="2" face="Segoe UI">Inside the debugging tools for Windows folder there is another folder that is created that begins with Crash…The exceptions are logged in a text file that is named as PID-&lt;PID&gt;.exe… </font></li> </ol>  <p><font size="2" face="Segoe UI">Here is the script:</font></p>  <p><font color="#ff8000" size="2" face="Consolas">&lt;ADPlus&gt;      <br />&lt;Settings&gt;       <br />&lt;RunMode&gt;Crash&lt;/RunMode&gt;       <br />&lt;Option&gt;Quiet&lt;/Option&gt;       <br />&lt;/Settings&gt; </font></p>  <p><font color="#ff8000" size="2" face="Consolas">&lt;PreCommands&gt;      <br />&lt;Cmd&gt;.loadby sos mscorwks&lt;/Cmd&gt;       <br />&lt;/PreCommands&gt; </font></p>  <p><font color="#ff8000" size="2" face="Consolas">&lt;Exceptions&gt;      <br />&lt;Option&gt;NoDumpOnFirstChance&lt;/Option&gt;       <br />&lt;Option&gt;NoDumpOnSecondChance&lt;/Option&gt;       <br />&lt;Config&gt;       <br />&lt;Code&gt;clr&lt;/Code&gt;       <br />&lt;Actions1&gt;Log;Stack&lt;/Actions1&gt;       <br />&lt;CustomActions1&gt;.time;!pe-nested;!clrstack;!threads&lt;/CustomActions1&gt;       <br />&lt;ReturnAction1&gt;gn&lt;/ReturnAction1&gt;       <br />&lt;/Config&gt;       <br />&lt;/Exceptions&gt;       <br />&lt;/ADPlus&gt;</font></p>]]></content:encoded>
    </item>
  </channel>
</rss>