<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Guil on Technology</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/guil/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/guil/feed.xml</link>
    <description>Guns don&amp;#039;t kill people, the SOA WS-* stack kills people.</description>
    <lastBuildDate>Wed, 17 Apr 2019 03:47:37 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Handling .ASMX Soap Faults in Silverlight 3</title>
      <link>https://docs.microsoft.com/archive/blogs/guil/handling-asmx-soap-faults-in-silverlight-3</link>
      <pubDate>Fri, 26 Mar 2010 02:18:42 GMT</pubDate>
      <dc:creator><![CDATA[Guilherme Magalhães]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/guil/2010/03/26/handling-asmx-soap-faults-in-silverlight-3/</guid>
      <description><![CDATA[Silverlight 3.0 has much better support for soap faults than Silverlight 2. But it’s still not...]]></description>
      <content:encoded><![CDATA[<p>Silverlight 3.0 has much better support for soap faults than Silverlight 2. But it’s still not perfect.</p>  <p>The majority of the time it works well with WCF services with some tweaks, <a href="https://msdn.microsoft.com/en-us/library/dd470096(VS.96).aspx" target="_blank">as this MSDN article explains</a>. </p>  <p>But what about old .ASMX .NET webservices?</p>  <p>&#160;</p>  <p>There’s a couple things to understand before we handle those soap faults. </p>  <p>First, by limitations on the browser stack that I won’t go into detail, Silverlight can’t handle HTTP 500 responses. So our first task is to make sure that any ASMX responses are HTTP 200.</p>  <p>Second, ASMX faults are not as nice as WCF faults. So we have to handle them a little bit differently once we get them in Silverlight.</p>  <p>&#160;</p>  <p>Let’s get started on the first task.</p>  <p>&#160;</p>  <p>The easiest way of making sure all .ASMX responses are sent out of your server as HTTP 200 is to create a IHttpHandler.</p>  <p>To create your IHttpHandler, simply create a standard .NET Class Library, reference System.Web and add a regular class with this code in it:</p>  <p></p>  <p></p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:7867be26-d638-432b-b1c9-8d6a695658f2" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; overflow: auto; padding: 2px 5px;"><span style="color:#0000ff">public</span> <span style="color:#0000ff">class</span> <span style="color:#2b91af">SilverlightSoapFaultHandler</span> : <span style="color:#2b91af">IHttpHandler</span><br> {<br>     <span style="color:#0000ff">public</span> <span style="color:#0000ff">bool</span> IsReusable<br>     {<br>         <span style="color:#0000ff">get</span> { <span style="color:#0000ff">return</span> <span style="color:#0000ff">true</span>; }<br>     }<br> <br>     <span style="color:#0000ff">public</span> <span style="color:#0000ff">void</span> ProcessRequest(<span style="color:#2b91af">HttpContext</span> context)<br>     {<br>         <span style="color:#008000">// </span><br>         <span style="color:#008000">// ScriptHandlerFactory and friends are sealed so have to use reflection.. </span><br>         <span style="color:#008000">// </span><br>         <br>         <span style="color:#008000">// Make sure to use the right type signature (will change for .NET 4)</span><br>         <span style="color:#2b91af">IHttpHandlerFactory</span> fact = (<span style="color:#2b91af">IHttpHandlerFactory</span>)<span style="color:#2b91af">Activator</span>.CreateInstance(<span style="color:#2b91af">Type</span>.GetType(<span style="color:#a31515">&quot;System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35&quot;</span>));<br>         <span style="color:#2b91af">IHttpHandler</span> handler = fact.GetHandler(context, context.Request.RequestType, context.Request.RawUrl, context.Request.PhysicalApplicationPath);<br> <br>         <span style="color:#0000ff">try</span><br>         {<br>             <span style="color:#008000">// This will trap your asmx Exception and output 500 status and soap fault </span><br>             handler.ProcessRequest(context);<br> <br>             <span style="color:#008000">// force 200 status for Silverlight to receive fault code </span><br>             context.Response.StatusCode = 200;<br> <br>             context.ApplicationInstance.CompleteRequest();<br>         }<br>         <span style="color:#0000ff">finally</span><br>         {<br>             fact.ReleaseHandler(handler);<br>         }<br>     }<br> }</div> </div> </div>  <p>&#160;</p>  <p>After creating your IHttpHandler, register it on your .ASMX website web.config</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:23e6bd31-9faa-4aaa-92f8-be2e70c30da5" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; overflow: auto; padding: 2px 5px;"><span style="color:#0000ff">&lt;</span><span style="color:#a31515">add</span><span style="color:#0000ff"> </span><span style="color:#ff0000">verb</span><span style="color:#0000ff">=</span>&quot;<span style="color:#0000ff">*</span>&quot;<span style="color:#0000ff"> </span><span style="color:#ff0000">path</span><span style="color:#0000ff">=</span>&quot;<span style="color:#0000ff">*.asmx</span>&quot;<span style="color:#0000ff"> </span><span style="color:#ff0000">validate</span><span style="color:#0000ff">=</span>&quot;<span style="color:#0000ff">false</span>&quot;<span style="color:#0000ff"> </span><span style="color:#ff0000">type</span><span style="color:#0000ff">=</span>&quot;<span style="color:#0000ff">CrmSilverlightHttpHandler.SilverlightSoapFaultHandler, CrmSilverlightHttpHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=*</span>&quot;<span style="color:#0000ff"> /&gt;</span></div> </div> </div>  <p>This will basically make every single request to asmx webservices return HTTP 200, no matter what.</p>  <p>&#160;</p>  <p>By now, if you run your Silverlight client you’ll probably stop getting the super annoying &quot;The remote server returned an error: NotFound.&quot; response.</p>  <p>&#160;</p>  <p>Good. Now all we have to do is get the proper fault details on your asynchronous Silverlight request. Simple:</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:4cdb66b1-8bd1-494a-a43b-9efabad60af1" class="wlWriterEditableSmartContent"> <div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"> <div style="background-color: #ffffff; overflow: auto; padding: 2px 5px;"><span style="color:#0000ff">if</span> (e.Error == <span style="color:#0000ff">null</span>)<br> { <br> }<br> <span style="color:#0000ff">else</span> <span style="color:#0000ff">if</span> (e.Error <span style="color:#0000ff">is</span> <span style="color:#2b91af">FaultException</span>)<br> {<br>     <span style="color:#2b91af">FaultException</span> fault = e.Error <span style="color:#0000ff">as</span> <span style="color:#2b91af">FaultException</span>;<br>     <span style="color:#2b91af">MessageFault</span> messageFault = fault.CreateMessageFault();<br> <br>     <span style="color:#0000ff">if</span> (messageFault.HasDetail)<br>     {<br>         <span style="color:#0000ff">string</span> description = messageFault.GetDetail&lt;<span style="color:#2b91af">XElement</span>&gt;().Element(<span style="color:#a31515">&quot;description&quot;</span>).Value;<br>         <span style="color:#0000ff">string</span> code = messageFault.GetDetail&lt;<span style="color:#2b91af">XElement</span>&gt;().Element(<span style="color:#a31515">&quot;code&quot;</span>).Value;<br>         <span style="color:#0000ff">string</span> type = messageFault.GetDetail&lt;<span style="color:#2b91af">XElement</span>&gt;().Element(<span style="color:#a31515">&quot;type&quot;</span>).Value;<br>     }<br> }</div> </div> </div>  <p>&#160;</p>  <p>If you want things really tidy (I didn’t had time for this, sorry), try to write your own error descriptor and use FaultException&lt;T&gt;.</p>  <p>&#160;</p>  <p>Happy Silverlight coding!</p>  <p>&#160;</p>  <p>Good reading:</p>  <p>Creating and Handling Faults in Silverlight   <br /><a href="https://msdn.microsoft.com/en-us/library/dd470096(VS.96).aspx">https://msdn.microsoft.com/en-us/library/dd470096(VS.96).aspx</a></p>  <p>Data Performance and Fault Strategies in Silverlight 3   <br /><a href="https://msdn.microsoft.com/en-us/magazine/ee294456.aspx">https://msdn.microsoft.com/en-us/magazine/ee294456.aspx</a></p>]]></content:encoded>
    </item>
    <item>
      <title>New Windows 7 features</title>
      <link>https://docs.microsoft.com/archive/blogs/guil/new-windows-7-features</link>
      <pubDate>Fri, 24 Apr 2009 12:27:00 GMT</pubDate>
      <dc:creator><![CDATA[Guilherme Magalhães]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/guil/2009/04/24/new-windows-7-features/</guid>
      <description><![CDATA[One of the coolest features of Win7, and IMO one of the most important features for the Windows...]]></description>
      <content:encoded><![CDATA[<p>One of the coolest features of Win7, and IMO one of the most important features for the Windows platform, is XPM.</p>  <p><a href="https://www.withinwindows.com">Rafael Rivera</a> did a great job explaining what it is.</p>  <p>&#160;</p>  <p>Alongside the new features of Terminal Services (that I’m not sure if are public yet so I’ll not mention), I reckon this will give the space that the Windows team needs to make future versions of Windows rock even more. </p>  <p>&#160;</p>  <p>You can read Rafael’s post <a href="https://www.withinwindows.com/2009/04/24/secret-no-more-revealing-windows-xp-mode-for-windows-7/" target="_blank">here</a>.</p>  <p>&#160;</p>  <p>Windows 7 is looking absolutely fantastic by the way :)</p>]]></content:encoded>
    </item>
    <item>
      <title>Hyper-v running slow with kernel time peaks on Nvidia Quadro FX 570</title>
      <link>https://docs.microsoft.com/archive/blogs/guil/hyper-v-running-slow-with-kernel-time-peaks-on-nvidia-quadro-fx-570</link>
      <pubDate>Sun, 19 Apr 2009 20:17:06 GMT</pubDate>
      <dc:creator><![CDATA[Guilherme Magalhães]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/guil/2009/04/19/hyper-v-running-slow-with-kernel-time-peaks-on-nvidia-quadro-fx-570/</guid>
      <description><![CDATA[If you noticed your Windows 2008 machine with Hyper-V enabled often showing kernel time spikes, you...]]></description>
      <content:encoded><![CDATA[<p>If you noticed your Windows 2008 machine with Hyper-V enabled often showing kernel time spikes, you probably have a high end graphics card installed.</p>  <p>&#160;</p>  <p>This KB article tells you why this happens :)</p>  <p><a title="https://support.microsoft.com/kb/961661" href="https://support.microsoft.com/kb/961661">https://support.microsoft.com/kb/961661</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Manage XPath namespaces programmatically in LINQ to XML</title>
      <link>https://docs.microsoft.com/archive/blogs/guil/manage-xpath-namespaces-programmatically-in-linq-to-xml</link>
      <pubDate>Sun, 19 Apr 2009 15:35:00 GMT</pubDate>
      <dc:creator><![CDATA[Guilherme Magalhães]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/guil/2009/04/19/manage-xpath-namespaces-programmatically-in-linq-to-xml/</guid>
      <description><![CDATA[Want to use XPath with LINQ to XML on files with lots namespaces, like InfoPath forms?   This might...]]></description>
      <content:encoded><![CDATA[<p>Want to use XPath with LINQ to XML on files with lots namespaces, like InfoPath forms? </p>  <p>This might help you :) </p>  <pre class="code"><span style="color: green">// Add all namespaces on your document 

</span><span style="color: blue">public static class </span><span style="color: #2b91af">MyExtensions
</span>{
    <span style="color: blue">public static </span>XmlNamespaceManager CreateNamespaceManager(<span style="color: blue">this </span>XDocument doc)
    {
        XmlNamespaceManager nsmgr = <span style="color: blue">new </span>XmlNamespaceManager(doc.CreateReader().NameTable);
        
        <span style="color: blue">foreach </span>(XAttribute attr <span style="color: blue">in </span>doc.Root.Attributes())
        {
            <span style="color: blue">if </span>(attr.IsNamespaceDeclaration)
                nsmgr.AddNamespace(attr.Name.LocalName, attr.Value);
        }

        <span style="color: blue">return </span>nsmgr;
    }
} </pre>
<a href="https://11011.net/software/vspaste"></a>

<p>Then query your XDocument using the System.Xml.XPath extensions: </p>

<pre class="code">XDocForm.XPathSelectElement(<span style="color: #a31515">&quot;/my:Field1/my:Field2/my:Level1&quot;</span>, XmlForm.CreateNamespaceManager());</pre>
<a href="https://11011.net/software/vspaste"></a>]]></content:encoded>
    </item>
    <item>
      <title>SQL Server 2008 installation dependency problems with Visual Studio 2008 SP1</title>
      <link>https://docs.microsoft.com/archive/blogs/guil/sql-server-2008-installation-dependency-problems-with-visual-studio-2008-sp1</link>
      <pubDate>Sun, 14 Dec 2008 17:58:57 GMT</pubDate>
      <dc:creator><![CDATA[Guilherme Magalhães]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/guil/2008/12/14/sql-server-2008-installation-dependency-problems-with-visual-studio-2008-sp1/</guid>
      <description><![CDATA[While installing SQL Server 2008 on a 64bit machine with Visual Studio 2008 SP1 installed you may...]]></description>
      <content:encoded><![CDATA[<p>While installing SQL Server 2008 on a 64bit machine with Visual Studio 2008 SP1 installed you may come across a dependency check error:</p>  <p>&#160;</p>  <p>Rule &quot;Previous releases of Microsoft Visual Studio 2008&quot; failed.    <br />A previous release of Microsoft Visual Studio 2008 is installed on this computer. Upgrade Microsoft Visual Studio 2008 to the SP1 before installing SQL Server 2008.</p>  <p>&#160;</p>  <p>This error is documented on <a href="https://support.microsoft.com/kb/956139" target="_blank">KB 956139</a>, &quot;Actions that are required before you install SQL Server 2008 on a computer that has Visual Studio 2008 or the prerelease version of SQL Server 2008 installed&quot;.</p>  <p>&#160;</p>  <p>I had Visual Studio SP1 (version 9.0.30729.1 SP) properly installed on my machine, so why this message? Well, with a quick monitoring using <a href="https://technet.microsoft.com/en-us/sysinternals/bb896645.aspx" target="_blank">Process Monitor</a> I noticed that the setup process was looking for ServicePack information on the WoW64 registry key, that was outdated:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/guil/WindowsLiveWriter/SQLServer2008installationdependencyprobl_A893/image_4.png" original-url="https://blogs.msdn.com/blogfiles/guil/WindowsLiveWriter/SQLServer2008installationdependencyprobl_A893/image_4.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="242" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/guil/WindowsLiveWriter/SQLServer2008installationdependencyprobl_A893/image_thumb_1.png" original-url="https://blogs.msdn.com/blogfiles/guil/WindowsLiveWriter/SQLServer2008installationdependencyprobl_A893/image_thumb_1.png" width="404" border="0" /></a>     <br />HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\DevDiv\VS\Servicing\9.0\IDE\1033</p>  <p>&#160;</p>  <p>&#160;</p>  <p>In order to fix it, you can update the SP and SPIndex entries to 1 and the SPName to SP1; just like the registry key at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\VS\Servicing\9.0\BSLN\1033:&quot;</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/guil/WindowsLiveWriter/SQLServer2008installationdependencyprobl_A893/image_6.png" original-url="https://blogs.msdn.com/blogfiles/guil/WindowsLiveWriter/SQLServer2008installationdependencyprobl_A893/image_6.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="243" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/guil/WindowsLiveWriter/SQLServer2008installationdependencyprobl_A893/image_thumb_2.png" original-url="https://blogs.msdn.com/blogfiles/guil/WindowsLiveWriter/SQLServer2008installationdependencyprobl_A893/image_thumb_2.png" width="404" border="0" /></a></p>]]></content:encoded>
    </item>
  </channel>
</rss>