Thursday, January 13, 2011

Error when accessing XML Web service hosted in Windows Azure

Hi Folks,

I was developing a web role and i have a XML web service in my web role, I created a client application to access this web service. the client works on my development fabric. but after i deployed the web role in windows azure, I wasn't able to access the web service in the app fabric and i was getting this error:

{"A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond MYAPP_IP:20000"}

The problem is the App Fabric doesn't allow any inbound http connections to any role in the App Fabric unless you specify an endpoint in the service definition file.

So, the solution is to define an endpoint in the service definition file with the port specified in the web role.

To do this:

1) From VS 2010 -> Right click on the role

2) Click on Endpoints from the role properties left tab and add your End Point:

Name: HTTPInWS Protocol: Http Port: 20000

3) Build and publish your web role.

5) Add a web reference in your client application and try to consume the web service.

You will be able to access XML web service function with no errors.

Note: You have to have Azure SDK V1.3 at least to define more than endpoint in your cloud role.

Hope this helps.

Regards,
Mostafa Arafa
twitter.com/mostafaelzoghbi

No comments: