Azure Web service on same domain as web page
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.
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?
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.
精彩评论