ASMX Service problem on Azure?
-
Monday, September 13, 2010 3:02 PM
Hi,
I have a very simple ASMX webservice on Azure that when invoked writes a simple string to a table in my SQL Azure database. This works completly fine (getting an entry in Azure database) when I run the project locally within VS2010 and invoke the WebService command using the following connectionstring:
Friend LiveConn As String = "Server=tcp:fd8wkenf.database.windows.net;Database=Live;User ID=master@fd8wkenf;Password=*;Trusted_Connection=False;Encrypt=True;"
Now, I add a webrole to my solution, and deploy it to Windows Azure, and then i browse to the ASMX service on Azure and invoke my method. It takes a few seconds and then the internet explorer gives me an error, basically an 404 error saying destination not reachable etc. When I check my database there is no entry there..
Whats wrong? Please help me :)
Mcad- Edited by Mcad01 Monday, September 13, 2010 3:20 PM
- Moved by DanielOdievichModerator Tuesday, September 28, 2010 11:02 PM forum migration (From:Windows Azure)
All Replies
-
Monday, September 13, 2010 3:08 PMModerator
First off, NEVER post credentials on a message board. I can't recommend strong enough editting these out of your poast and changing them ASAP.
For the root answer, did you check the azure services option in your SQL Azure database firewall configuration? If not, start there and give it up to an hour to replication. If you have, try opening up connections to all (after you change you credentials of course) and see if that helps.
Also, the 404 error is likely on the web role side, so are you forwarding on to another page? If so how are you addressing that next page?
-
Monday, September 13, 2010 3:33 PM
BrentDaCodeMonkey, firstly the credentials and database name etc are ofcourse "fake" in my intial post :) I just wanted to show how my connectionstring was built up in case I was forgetting something that I needed!
Microsoft Services option was not checked on my SQL Azure firewall, so I've done that now. Added IP range 0.0.0.0 -> 255.255.255.255.
"Also, the 404 error is likely on the web role side, so are you forwarding on to another page" : Hm.. I'm a bit unsure.. When I run it locally I first get to this url
http://127.0.0.1:81/LiveService.asmx?op=TestDbConnection
and after invoke it opens a new window with some kind of confimation, saying True and having this url:
http://127.0.0.1:5100/LiveService.asmx/TestDbConnection
Anyway, it might be that the Check on Microsoft Services was my problem.. I will wait and test again in a while..
Mcad -
Monday, September 13, 2010 3:46 PMModeratorcoolies. and I'm glad to hear that the credentials were fake ones. *insert sigh of relief here*
-
Monday, September 13, 2010 4:28 PMAnswerer
Microsoft Services option was not checked on my SQL Azure firewall, so I've done that now. Added IP range 0.0.0.0 -> 255.255.255.255.
Adding IP range 0.0.0.0 -> 255.255.255.255 appears to open your service to all possible IP addresses. It is a while since I have used SQL Azure but the following is documented:
Enable connection attempts from Windows Azure by using the
sp_set_firewall_rulestored procedure with the parametersstart_ip_addressandend_ip_addressequal to0.0.0.0.
-
Monday, September 13, 2010 6:35 PM
I'm so disappointed, tested the service again now and it still fails. So adding the IP range to Microsoft Services and wait a few hours didnt help.
I'm a bit lost, is it my connectionstring that is wrong? As mentioned in my opening post I'm using the exact same connectionstring (as seen above) when testing the service from VS2010 and when testing it from Windows Azure..
Weird that I can get a local compiled version of the service to write to my SQL Azure database, BUT I cannot get the excact same Service deployed to Windows Azure to write to the SQL Azure database. Afterall it's just a simple, 1 parameter webmethod its invoking so I findt it strange!
Mcad -
Monday, September 13, 2010 6:46 PMModeratorI'd go back to the URI's. I don't like the port and URI you have in the second link. It almost seems like its trying to jump to a new service. And the 404 error points at that service not existing.
-
Tuesday, September 14, 2010 2:30 AMModerator
Hi Mcad01,
There is a metadata port issue in WCF service, and after searching, i got to know that asmx have the same issue. I guess you encountered this issue.
There is workaround for WCF
http://code.msdn.microsoft.com/wcfazure/Wiki/View.aspx?title=KnownIssues&referringTitle=Home
But i'm not sure if there is a fix for asmx. On my opinion, you may try using WCF instead, or follow Yinlun Luo's advice, add service reference when running on local, and then change the client side configuration.
Thanks,
Mog Liang -
Tuesday, September 14, 2010 8:45 AM
No luck yet. Rewriting my asmx to be a WCF is not an alernative right now unfortunatly :(
I created the simplest of simple webmethod - "Hello World", and browse to my asmx service on azure:
http://liveservice.cloudapp.net/liveservice.asmx?op=HelloWorld on this page I hit the Invoke button .. Which send me to this page and giving an 404 error:
http://liveservice.cloudapp.net:20000/liveservice.asmx/HelloWorld
I dont understand it, how can this simplest form of WebMethod not be running - is it a port issue here?
My simple hello world method in the asmx file is defined like this:
As said before, everything works fine when testing the service locally on my machine, even with a connection to SQL Azure database I'm able to write to it... Do I need anything special in the WebConfig file or in the serviceconfiguration (this is default now)..<WebMethod()> _ Public Function HelloWorld() As String Return "Hello World" End Function
Mcad -
Tuesday, September 14, 2010 3:01 PMAnswerer
Mcad -
You identify the URL of your service as http://liveservice.cloudapp.net. Is your service really at liveservice? If, for example, you uploaded your service to a staging slot you would have a GUID where you have liveservice.
-
Tuesday, September 14, 2010 3:16 PM
The URL name is slightly modified so that I do not post the whole and correct url on the board here. I'm perfectly able to browse to my url from my machine. It's not in a staging slot, I have my asmx service as a New Service under Windows Azure on the Windows Azure platform... I can also invoke my webmethods from internet explorere, this gives me the behaviour described above... the 404.. and no entries in Sql azure database. When running the service on my local machine, and invoking the webmethods with the same parameters I'm getting data in SQl Azure! So..I'm confused!
Is there a way I can add some logging code etc to an asmx service on azure to see why the service disposes/throws away the data I'm sending to it while in webbrowser? Also I have some client machines setup at the office that's sending data to the service, no errormessages returned, but no data in SQL Azure database either.. So I suspect the service is throwing them away somehow!
Mcad -
Wednesday, September 15, 2010 1:24 AMModerator
No luck yet. Rewriting my asmx to be a WCF is not an alernative right now unfortunatly :(
I created the simplest of simple webmethod - "Hello World", and browse to my asmx service on azure:
http://liveservice.cloudapp.net/liveservice.asmx?op=HelloWorld on this page I hit the Invoke button .. Which send me to this page and giving an 404 error:
http://liveservice.cloudapp.net:20000/liveservice.asmx/HelloWorld
I dont understand it, how can this simplest form of WebMethod not be running - is it a port issue here?
My simple hello world method in the asmx file is defined like this:
As said before, everything works fine when testing the service locally on my machine, even with a connection to SQL Azure database I'm able to write to it... Do I need anything special in the WebConfig file or in the serviceconfiguration (this is default now)..<WebMethod()> _ Public Function HelloWorld() As String Return "Hello World" End Function
Mcad
This should be the port issue I mentioned before. We cannot invoke method through webservice page in browser, however, we could invoke the service successfully by generated asmx proxy with correct address.You may try use asmx proxy to invke the service and see if it works.
Thanks,
Mog Liang- Marked As Answer by Mcad01 Friday, September 17, 2010 7:45 AM
-
Friday, September 17, 2010 7:47 AM
My issue was related to the above mentioned port issue.
I solved my problem by following the text and video in this blog: http://blogs.msdn.com/davidlem/archive/2009/01/07/windows-azure-and-web-services.aspx
Thank you all for your help!
Mcad

