views:

103

answers:

2

I have a JSON web service that I want to run on the same domain as my Web page. Both are to be used in Azure. They need to be on the same domain because since Im doing a JSON call, JSONP is not an option atm.

I was thinking that my web would have the address http://example.cloudapp.net/, and my Web Service should have the address http://example.cloudapp.net/webservice/

Edit: How can I create a web service at http://example.cloudapp.net/webservice/ and a MVC 2 Web App at http://example.cloudapp.net/ , I have only figured out how to make them use their separate domain, like http://ws-example.cloudapp.net/ for the web service and http://example.cloudapp.net/ for the web app.

+2  A: 

What's your question?

The same way you do outside of the cloud. If the service itself is implemented in a MVC controller, you just need to make sure the routes are correct in your MVC app. If you're using WCF, I'm not sure if there's anything special you need to do to avoid conflicts with the MVC routing. Have you tried anything yet? Did you hit an error?

smarx
How can I create a web service at http://example.cloudapp.net/webservice/ and a MVC 2 Web App at http://example.cloudapp.net/ , I have only figured out how to make them use their separate domain, like http://ws-example.cloudapp.net/ for the web service and http://example.cloudapp.net/ for the web app.
Inge Henriksen
The same way you do outside of the cloud. If the service itself is implemented in a MVC controller, you just need to make sure the routes are correct in your MVC app.If you're using WCF, I'm not sure if there's anything special you need to do to avoid conflicts with the MVC routing. Have you tried anything yet? Did you hit an error?
smarx
@smarx, since your comment was really more of an answer, I copied it into the body of your answer.
Dennis Palmer
If I try to use the same endpoint (HttpIn port 80), Visual Studio complains. Is there no way of two web roles sharing the same port?
Inge Henriksen
Correct. Each web role has its own port.
smarx
A: 

WCF endpoints (svc files) can be part of your normal WebRole, even when using MVC.

This article provides a number of samples illustrating the usage of WCF on Windows Azure platform: http://code.msdn.microsoft.com/wcfazure/

This wiki page discusses the issues you may hit when using WCF on Windows Azure and provides workarounds for each of them: code.msdn.microsoft.com/wcfazure/Wiki/View.aspx?title=KnownIssues.

Canoas