<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Luis Guerrero EN &#187; Azure</title>
	<atom:link href="http://luisguerrero.net/en/category/azure/feed/" rel="self" type="application/rss+xml" />
	<link>http://luisguerrero.net/en</link>
	<description>.NET Stuff from London, Windows Phone 7, Silverlight, WPF and debugging</description>
	<lastBuildDate>Sat, 30 Apr 2011 15:44:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Run elevated task at any point of the Azure Rol lifetime.</title>
		<link>http://luisguerrero.net/en/2011/04/30/run-elevated-task-at-any-point-of-the-azure-rol-lifetime/</link>
		<comments>http://luisguerrero.net/en/2011/04/30/run-elevated-task-at-any-point-of-the-azure-rol-lifetime/#comments</comments>
		<pubDate>Sat, 30 Apr 2011 15:36:30 +0000</pubDate>
		<dc:creator>Guerrerotook</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Azure]]></category>
		<category><![CDATA[wcf]]></category>
		<category><![CDATA[elevated]]></category>
		<category><![CDATA[role]]></category>
		<category><![CDATA[startup]]></category>
		<category><![CDATA[task]]></category>

		<guid isPermaLink="false">http://luisguerrero.net/en/?p=40</guid>
		<description><![CDATA[There are two mostly common used for Windows Azure, starting a new 100% .NET project on Windows Azure, or migrate a legacy project to the cloud. Talking from this point legacy project could be the most difficult project of all, because can use COM components during him lifetime. As you may know all the Windows [...]]]></description>
			<content:encoded><![CDATA[<p>There are two mostly common used for Windows Azure, starting a new 100% .NET project on Windows Azure, or migrate a legacy project to the cloud. Talking from this point legacy project could be the most difficult project of all, because can use COM components during him lifetime. As you may know all the Windows Azure roles are clean machine so it’s means that you need to install manually all your component COM. Normally this issue is solved by placing on the startup node of the Role configuration file, a .cmd file with all the registration of the COM components.</p>
<p>But what happens if during role’s lifetime you need to execute a task elevated? You can’t do that because the hosting process of the worker role and web role is not executing with elevated rights. So we have to find a place where we can execute task with elevated rights, and this places is the roll’s startup node. So what we have to do is have a sentinel program up and running at roll’s startup and make this sentinel program to accept requests to execute process.</p>
<p>So this is exactly what we are going to do, using WCF to open a Windows pipe to enable communication between two different process in the same machine, enabling the process to send message with the necessary information to run this elevated task.</p>
<p>Let’s do it!</p>
<h1>Service definition.</h1>
<p>Since all we need is a WCF service be exposed on NetNamedPipeBinding, first of all we have to define a service contract with the operation contract we need. In this case we only need one operation, ExecuteTask.</p>
<div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">[ServiceContract(Namespace = <span style="color: #006080">&quot;http://azure.plainconcepts.com/schemas/04/2011/azure/executionhost&quot;</span>)]
<span style="color: #0000ff">public</span> <span style="color: #0000ff">interface</span> IExecutionHost
{
    [OperationContract]
    <span style="color: #0000ff">void</span> ExecuteTask(ProcessTask host);
}</pre>
</div>
<p>Once we define the service contract now is the time to create the service itself, who is responsible to finally execute the tasks. </p>
<div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
<span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> ExecutionHostService : IExecutionHost
{
    <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> ExecuteTask(ProcessTask host)
    {
        Process process = <span style="color: #0000ff">new</span> Process();
        process.StartInfo = host.StartInfo;
        process.Start();
    }
}</pre>
</div>
<p>When we have done this, the next step is host the server itself on the sentinel process that will handle the requests, as we said before we’re going to use the NetNamedPipeBinding.</p>
<div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> ExecutionHostServiceManager
{
    <span style="color: #0000ff">public</span> ExecutionHostServiceManager()
    {
        service = <span style="color: #0000ff">new</span> ExecutionHostService();
        ServiceHost host = <span style="color: #0000ff">new</span> ServiceHost(service);

        <span style="color: #0000ff">string</span> address = <span style="color: #006080">&quot;net.pipe://PlainConcepts/Azure/ExecutionHost&quot;</span>;
        NetNamedPipeBinding binding = <span style="color: #0000ff">new</span> NetNamedPipeBinding(NetNamedPipeSecurityMode.None);
        host.AddServiceEndpoint(<span style="color: #0000ff">typeof</span>(IExecutionHost), binding, address);

        <span style="color: #008000">// Add a mex endpoint</span>
        <span style="color: #0000ff">long</span> maxBufferPoolSize = binding.MaxBufferPoolSize;

        <span style="color: #0000ff">int</span> maxBufferSize = binding.MaxBufferSize;

        <span style="color: #0000ff">int</span> maxConnections = binding.MaxConnections;

        <span style="color: #0000ff">long</span> maxReceivedMessageSize =
            binding.MaxReceivedMessageSize;

        NetNamedPipeSecurity security = binding.Security;

        <span style="color: #0000ff">string</span> scheme = binding.Scheme;

        XmlDictionaryReaderQuotas readerQuotas =
            binding.ReaderQuotas;

        BindingElementCollection bCollection = binding.CreateBindingElements();

        HostNameComparisonMode hostNameComparisonMode =
            binding.HostNameComparisonMode;

        <span style="color: #0000ff">bool</span> TransactionFlow = binding.TransactionFlow;

        TransactionProtocol transactionProtocol =
            binding.TransactionProtocol;

        EnvelopeVersion envelopeVersion =
            binding.EnvelopeVersion;

        TransferMode transferMode =
            binding.TransferMode;
        host.Open();
    }

    <span style="color: #0000ff">private</span> ExecutionHostService service;
}</pre>
</div>
<p>And that is!</p>
<p>Now we have to put this together in a console application and wait forever.</p>
<div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">class</span> Program
{
    <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> Main(<span style="color: #0000ff">string</span>[] args)
    {
        <span style="color: #0000ff">new</span> ExecutionHostServiceManager();
        Thread.Sleep(Timeout.Infinite);
    }
}</pre>
</div>
<h3>Making call to the service</h3>
<p>We now have the service contract, the service definition and the hosting process, now it’s time to define the client and make call to the servicer. Since we’re using WCF we need to define a class that will handle the request to the pipe. To accomplish this it’s necessary to inherit from ClientBase&lt;T&gt;, and T need to the service contract of the service.</p>
<div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> ExecutionHostClient : ClientBase&lt;IExecutionHost&gt;
{
    <span style="color: #0000ff">static</span> ExecutionHostClient()
    {
        <span style="color: #0000ff">string</span> address = <span style="color: #006080">&quot;net.pipe://PlainConcepts/Azure/ExecutionHost&quot;</span>;
        NetNamedPipeBinding binding = <span style="color: #0000ff">new</span> NetNamedPipeBinding(NetNamedPipeSecurityMode.None);
        binding.CloseTimeout = TimeSpan.MaxValue;
        binding.ReceiveTimeout = TimeSpan.MaxValue;
        binding.SendTimeout = TimeSpan.MaxValue;
        EndpointAddress endpoint = <span style="color: #0000ff">new</span> EndpointAddress(address);
        client = <span style="color: #0000ff">new</span> ExecutionHostClient(binding, endpoint);
    }

    <span style="color: #0000ff">public</span> ExecutionHostClient(Binding binding, EndpointAddress remoteAddress) :
        <span style="color: #0000ff">base</span>(binding, remoteAddress)
    {
    }

    <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> ExecuteTask(ProcessTask task)
    {
        Channel.ExecuteTask(task);
    }

    <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> ExecuteRemoteTask(ProcessTask task)
    {
        client.ExecuteTask(task);
    }

    <span style="color: #0000ff">private</span> <span style="color: #0000ff">static</span> ExecutionHostClient client;
}</pre>
</div>
<p>It’s important to create this proxy with the same configuration of the server, because we’re not using the default Visual Studio code generated proxy, and it’s our responsibility to create the binding and the address of the endpoint.</p>
<h3>Invoking services</h3>
<p>In this example we are registering COM components by calling the regsvc32.exe in code. We looking for dll files on a known folder of our Windows Azure Solution and invoke the service to make the elevated call.</p>
<div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> RegisterComHelper
{
    <span style="color: #0000ff">public</span> RegisterComHelper()
    {

    }

    <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> Register()
    {
        <span style="color: #008000">// hay que buscar la localizacion en el servidor de azure de donde estan los ensamblados</span>
        <span style="color: #008000">// como no sabemos donde estan los ficheros tenemos que buscar el modulo </span>
        <span style="color: #008000">// Habitania.RegisterCom.dll que es especifico para este ejemplo</span>
        <span style="color: #008000">// así nos aseguramos que estamos buscando la dll correcta</span>
        Process current = Process.GetCurrentProcess();
        var found = (from p <span style="color: #0000ff">in</span> current.Modules.Cast&lt;ProcessModule&gt;().ToList()
                     <span style="color: #0000ff">where</span> p.ModuleName == <span style="color: #006080">&quot;PlainConcepts.Azure.WorkerRoleDemo.dll&quot;</span>
                     select p).FirstOrDefault();

        <span style="color: #0000ff">if</span> (found != <span style="color: #0000ff">null</span>)
        {
            <span style="color: #008000">// a partir de la locacion del modulo cargada por el proceso </span>
            <span style="color: #008000">// somos capaces de encontrar la informacion del directorio y buscar</span>
            <span style="color: #008000">// la carpeta dlls que contiene la lista de dlls que queremos registar</span>
            <span style="color: #0000ff">string</span> directoryLocation = Path.GetDirectoryName(found.FileName);

            <span style="color: #0000ff">string</span> dllPath = Path.Combine(directoryLocation, <span style="color: #006080">&quot;V3COM30&quot;</span>);

            <span style="color: #0000ff">string</span>[] files = Directory.GetFiles(dllPath);

            <span style="color: #0000ff">foreach</span> (var item <span style="color: #0000ff">in</span> files)
            {
                <span style="color: #0000ff">if</span> (item.EndsWith(<span style="color: #006080">&quot;.dll&quot;</span>))
                    RegisterComObject(item);
            }

            dllPath = Path.Combine(directoryLocation, <span style="color: #006080">&quot;V3COM&quot;</span>);

            files = Directory.GetFiles(dllPath);

            <span style="color: #0000ff">foreach</span> (var item <span style="color: #0000ff">in</span> files)
            {
                <span style="color: #0000ff">if</span> (item.EndsWith(<span style="color: #006080">&quot;.dll&quot;</span>))
                    RegisterComObject(item);
            }
        }
    }

    <span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> RegisterComObject(<span style="color: #0000ff">string</span> filePath)
    {
        ProcessStartInfo info = <span style="color: #0000ff">new</span> ProcessStartInfo();
        info.FileName = Path.Combine(
            Environment.GetFolderPath(Environment.SpecialFolder.System),
            <span style="color: #006080">&quot;regsvr32.exe&quot;</span>);
        info.Arguments = <span style="color: #0000ff">string</span>.Format(<span style="color: #006080">&quot;/i {0}&quot;</span>, filePath);
        info.UseShellExecute = <span style="color: #0000ff">false</span>;

        ExecutionHostClient.ExecuteRemoteTask(<span style="color: #0000ff">new</span> ProcessTask()
        {
            StartInfo = info
        });
    }
}</pre>
</div>
<p>This way of invoking task on Windows Azure seems a little bit complicated, but once is done can be super flexible and permit to extend this demo with custom task and background tasks.</p>
<p>The complete source code can be downloaded from <a href="http://www.luisguerrero.net/downloads/ExecuteProcessElevated.zip">here</a>.</p>
<p>Luis Guererro.</p>
]]></content:encoded>
			<wfw:commentRss>http://luisguerrero.net/en/2011/04/30/run-elevated-task-at-any-point-of-the-azure-rol-lifetime/feed/</wfw:commentRss>
		<slash:comments>1689</slash:comments>
		</item>
		<item>
		<title>Azure worker role throw a FileLoadException on load</title>
		<link>http://luisguerrero.net/en/2010/05/11/azure-worker-role-throw-a-fileloadexception-on-load/</link>
		<comments>http://luisguerrero.net/en/2010/05/11/azure-worker-role-throw-a-fileloadexception-on-load/#comments</comments>
		<pubDate>Tue, 11 May 2010 10:24:00 +0000</pubDate>
		<dc:creator>Guerrerotook</dc:creator>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Debugging]]></category>

		<guid isPermaLink="false">http://www.luisguerrero.net/en/post.aspx?id=c2f0d7b8-462d-4a24-9517-d21c32fb5948</guid>
		<description><![CDATA[I’m working now on a Smooth Streaming Silverlight player for the world cup and we using Azure to host some services for the player. Recently I started the development of all those services on a Web project and when I’m trying to run the project inside the Azure Simulation Environment the web role throw me [...]]]></description>
			<content:encoded><![CDATA[<p>I’m working now on a Smooth Streaming Silverlight player for the world cup and we using Azure to host some services for the player. Recently I started the development of all those services on a Web project and when I’m trying to run the project inside the Azure Simulation Environment the web role throw me a FileLoadException.</p>
<div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, 'Courier New', courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">[runtime] Role entrypoint could not be created:
System.IO.FileLoadException: Could not load file or assembly <span style="color: #006080">'Microsoft.Silverlight.MediaPlayer.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a10dc7bdece43c5c'</span> or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
File name: <span style="color: #006080">'Microsoft.Silverlight.MediaPlayer.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a10dc7bdece43c5c'</span> ---&gt; System.IO.FileLoadException: Could not load file or assembly <span style="color: #006080">'file:///C:\Plain\Microsoft.SmoothPlayer\Source\Azure\Microsoft.Silverlight.MediaPlayer.Online\bin\Debug\Microsoft.Silverlight.MediaPlayer.Online.csx\roles\Microsoft.Silverlight.MediaPlayer.Web\approot\bin\Microsoft.Silverlight.MediaPlayer.Web.dll'</span> or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
File name: <span style="color: #006080">'file:///C:\Plain\Microsoft.SmoothPlayer\Source\Azure\Microsoft.Silverlight.MediaPlayer.Online\bin\Debug\Microsoft.Silverlight.MediaPlayer.Online.csx\roles\Microsoft.Silverlight.MediaPlayer.Web\approot\bin\Microsoft.Silverlight.MediaPlayer.Web.dll'</span>

WRN: Assembly binding logging <span style="color: #0000ff">is</span> turned OFF.
To enable assembly bind failure logging, set the registry <span style="color: #0000ff">value</span> [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There <span style="color: #0000ff">is</span> some performance penalty associated with assembly bind failure logging.
To turn <span style="color: #0000ff">this</span> feature off, remove the registry <span style="color: #0000ff">value</span> [HKLM\Software\Microsoft\Fusion!EnableLog].

   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark&amp; stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark&amp; stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.CreateRoleEntryPoint(RoleType roleTypeEnum)
   at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeRoleInternal(RoleType roleTypeEnum)</pre>
</div>
<p>I double check that my local assembly Microsoft.Silverlight.MediaPlayer.Web.dll is there and have enough permission to read and load it. Also I enabled Fusion Log to catch the assembly fail load but I can’t find any references to my assembly… so I decided it’s time to WinDBG.</p>
<p>I attach to the process WaWebHost.exe (Microsoft Windows Azure Web Host), loaded all symbols and sos. The first command I wrote was !threads and I found this:</p>
<div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, 'Courier New', courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">0:000&gt; !threads
ThreadCount: 6
UnstartedThread: 0
BackgroundThread: 5
PendingThread: 0
DeadThread: 0
Hosted Runtime: no
                                              PreEmptive                                                Lock
       ID OSID        ThreadOBJ     State   GC     GC Alloc Context                  Domain           Count APT Exception
XXXX    1 1ba0 000000000014c4a0   2008220 Enabled  00000000053a1c10:00000000053a1fd0 0000000002f182a0     1 Ukn System.IO.PathTooLongException (0000000005305a80)
XXXX    2  294 00000000000e46d0      b220 Enabled  00000000053d09f8:00000000053d1fd0 0000000002f17990     0 MTA (Finalizer)
XXXX    3 13b0 00000000022f9350   a802220 Enabled  0000000000000000:0000000000000000 0000000002f17990     0 MTA (Threadpool Completion Port)
XXXX    4 1a80 0000000002fbc080    80a220 Enabled  0000000000000000:0000000000000000 0000000002f17990     0 MTA (Threadpool Completion Port)
XXXX    5 1ae0 0000000002fbe650      1220 Enabled  0000000000000000:0000000000000000 0000000002f17990     0 Ukn
   0    6  7e4 0000000002fe22c0      1020 Enabled  00000000053c69b0:00000000053c7fd0 0000000002f182a0     0 Ukn System.IO.FileLoadException (00000000053a7ca8)</pre>
</div>
<p>As you can see threre are two applications domain inside this process and one of them (<strong>0000000002f182a0</strong>) have to exception in thread #1 and #6.</p>
<p>The exception in Thread #6 is familiar but the other thread has a System.IO.PathTooLongException.</p>
<div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, 'Courier New', courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">0:001&gt; !pe 0000000005305a80
Exception <span style="color: #0000ff">object</span>: 0000000005305a80
Exception type: System.IO.PathTooLongException
Message: The specified path, file name, or both are too <span style="color: #0000ff">long</span>. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
InnerException: &lt;none&gt;
StackTrace (generated):
    SP               IP               Function
    00000000031BD360 000007FEED2D5A8F mscorlib_ni!System.IO.Path.NormalizePathFast(System.String, Boolean)+0xd0f
    00000000031BD420 000007FEED239CA6 mscorlib_ni!System.IO.File.Exists(System.String)+0x96

StackTraceString: &lt;none&gt;
HResult: 800700ce
The current thread <span style="color: #0000ff">is</span> unmanaged</pre>
</div>
<p>So it’s seem that my path it’s too long to be loaded by the runtime!</p>
<p>Hope this help!</p>
<p>Luis Guerrero.</p>
]]></content:encoded>
			<wfw:commentRss>http://luisguerrero.net/en/2010/05/11/azure-worker-role-throw-a-fileloadexception-on-load/feed/</wfw:commentRss>
		<slash:comments>2438</slash:comments>
		</item>
	</channel>
</rss>

