Windows Azure and Web Services!

So I've had a couple of questions about hosting web services (SOAP style services in the form of *.aspx pages in a Web Role or *.svc files in the form of WCF services) in Windows Azure, specifically, how to get them to work?

Now, as I've mentioned before, Windows Azure uses a design where the executing environment that your hosted service is running in is actually just a pre-configured VM running Windows Server 2008 x64 with .NET 3.5 Fx installed amongst other things. So technically, running an ASP.NET web service or a WCF service should be nothing more than adding the required components (pages) to your web role. But before you get to your VM, there is some infrastructure that you need to step across, and this is what is currently providing some challenges to running hosted web services on Windows Azure.

So right now, if you create a new web role project, add an asmx page to it, publish it to the cloud, and run the page, it will work a treat. If you then add that web reference to a client project, you will get an error. The error happens because of the way we currently configure the internal Windows Azure environment to handle internal and external comms pathways (how your external URI maps to your internal machine URI).

image

Now this is a known issue but until we release a fix, the workaround is:

1. Create your web role and add your service definition (asmx or svc component)

2. Run the project using the local development fabric

3. While the service is running, add the local reference to your client project which will generate a compliant wrapper. This is important, because if you try to add a reference to your published service, you will run into the issue above. By adding the reference against the local service, you get the service definition added to your project.

4. Now publish the service, and record the URI (should be something like https://guidforstaging_or_accountnameforlive.cloudapp.net/service.asmx_or_svc)

5. Go into your client project, and update the web service reference URI from the local address to your live address

Your service will now be able to connect to your live service and have all the information it needs to communicate without having to do the discovery process against the live environment.

Here is a quick screen cast that demonstrates the work around process.

Screencast

Also, check out the following links for more info:

Enjoy :)

Technorati Tags: Windows Azure Samples,Web Services

Comments

  • Anonymous
    January 07, 2009
    PingBack from http://www.alvinashcraft.com/2009/01/07/dew-drop-january-7-2009/

  • Anonymous
    January 07, 2009
    I've also got a walkthrough with screenshots of how to do this http://davidburela.wordpress.com/2008/12/09/wcf-services-hosted-on-windows-azure/

  • Anonymous
    January 14, 2009
    Вышла новая версия SDK и плагина к Visual Studio для Windows Azure. что нового : В плагине Исправлены

  • Anonymous
    January 14, 2009
    Вышла новая версия SDK и плагина к Visual Studio для Windows Azure. что нового : В плагине Исправлены

  • Anonymous
    January 26, 2009
    So I've blogged previously about a known issue regarding port translation/mapping in Windows Azure ,

  • Anonymous
    February 22, 2009
    For the 828 event next Thursday I’m developing some examples. One of them is where I get all speed traps