Welcome to MSDN Blogs Sign in | Join | Help

Hosting Roles Under .NET Full Trust

One of the great things about Windows Azure is that it handles the deployment, monitoring, and management of your service so that you have more time to focus on the business logic.  Until recently, realizing these benefits meant your code had to run under Windows Azure partial trust, a code access security (CAS) level which locks down certain .NET functionality.

Windows Azure now offers the option of running the code in your Web and worker roles under full trust.  This unlocks a number of compelling scenarios such as:

  • Invoking non-.NET Code: Many developers have existing investments in native code or may choose to use native code for some specialized tasks.  .NET full trust makes it possible to use native code via spawning processes or Platform Invoke (P/Invoke).
  • Using .NET Libraries that Require Full Trust: Certain .NET libraries, including libraries in the .NET Services SDK, require full trust and can now be used in Windows Azure.
  • Inter-process Communication via Named Pipes: If you application spawns processes, you can communicate among them via named pipes.

Note:  While .NET full trust lifts CAS limitations, Windows Azure applications run with restricted “User” privileges in the cloud.  Accordingly, certain operations such as modifying the registry and writing to the system directory are not possible at this time (even though they may succeed in your local development environment).

How to Get Started

To enable full trust, simply add the enableNativeCodeExecution attribute to your role in the Service Definition file and set the attribute value to true:

<?xml version="1.0" encoding="utf-8"?>

<ServiceDefinition name="MyService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">

  <WebRole name="WebRole" enableNativeCodeExecution="true">

    <InputEndpoints>

      <InputEndpoint name="HttpIn" protocol="http" port="80" />

    </InputEndpoints>

  </WebRole>

</ServiceDefinition>

For more detail, please refer to the documentation and the FullTrust sample in the Windows Azure SDK.  Enjoy!

Mohit Srivastava
Program Manager

Published Wednesday, March 18, 2009 5:49 PM by WindowsAzure

Comments

# MIX 2009 – Nouveautes au sein de la CTP de Windows Azure : FastCGI, Full Trust et Geo-localisation

Je vous en avais parlé rapidement lors de la session plénière de ce matin, Microsoft nous a annoncé quelques

Wednesday, March 18, 2009 9:07 PM by RedoBlog - The .NET Gentleman !!!

# MIX09 での Azure アップデートについて

MIX09 Day1 キーノートでは、Silverlight の話に多くの時間を費やしたキーノートでしたので、Azure の話は目立ちませんが、いくつかアップデートを発表しております。 FastCGI,

Thursday, March 19, 2009 3:51 AM by Fumio Sekita's Blog

# re: Hosting Roles Under .NET Full Trust

hi there,

I want to share a little bit of my experience when trying to host my site. When I was building my site on my local PC, everything runs smoothly as everything is in "administrator" mode. I then had my site hosted at GoDaddy and I realised that some parts are not working due to the fact that this host does not support Full Trust mode :(

I wandered around, looking for plenty of hosts which support Full Trust mode and I managed to send inquiries to a couple of potential hosts. Lastly, I decided to host my site at ASPHostCentral (http://www.asphostcentral.com) as at the time when I asked, they are able to:

1. provide a quick response to my questions

2. able to demonstrate the full trust setting to me (this is important for me!)

3. provide a very reasonable hosting price (only $4.99!) with free 1 domain and database

4. provide a guarantee in terms of money-back in case my site is not working on their environment

Up until now, everything is looking extremely good there and my site is running smooth since the start of the service. I am impressed and I certainly can recommend their services to you all.

All the best and good luck!

Friday, July 24, 2009 2:36 AM by necro_mancer
Anonymous comments are disabled
 
Page view tracker