Location of crossdomain.xml Windows Azure - windows

I need to put a crossdomain.xml file in my Windows Azure Web Role. But where ?
I tried to put it in : F:\sitesroot\0
But my Unity3D Web App says : Exception: Unable to connect, as no valid crossdomain policy was found.
I don't know what I am missing. Unity uses by default port (843).
Where to put the crossdomain.xml
Any help is welcome !

CrossDomainPolicy.xml must be at the root of your application.
If you are using single Web Role just add CrossDomainPolicy.xml at the root of your application and set it up correctly as below:
Depends on how many "sites" sections you have in your role's ServiceDefinition.csdef , you will get that many \sitesroot\0 and \sitesroot\1 and CrossDomainPolicy.xml will be distributed to all depend on your role solution settings.
Once I discussed this in my following blog:
Silverlight front end calling to WCF Service, all in one Windows Azure Web Role Sample

You mentioned port 843, which sounds like it would need the Flash protocol, which is a TCP socket listener on port 843 that responds with the cross domain policy when it receives the text <policy-file-request/>. Do you need to be doing that? Does your app use sockets?
Avkash's answer is correct for where the XML file should go if you just need to serve it via port 80 from your web app, but if you need to do raw sockets, you'll need to be running something on the server that handles that.

Related

How to connect a web app to a gamefleet instance?

I've gone over the intro amazon gamelift tutorial, and something I'm trying to understand is how a web app transitions from communicating with the app backend to a gamelift instance.
For example the following call can tell the backend that an available session exists, and returns a list of IP addresses (as well as other information.) Is it a matter of returning that desired IP to the client, and transitioning to a websocket connection with that IP, or are there more authentication details I'm completely missing, etc.?
It looks like the client side SDK for this is still only available in C#:
https://forums.awsgametech.com/t/javascript-as-a-game-client-for-a-gamelift-server/7679/6
If I end up porting this to JS, I'll edit this comment to point to a public repository.

How do I increase the size of HTTP request header in my Azure App Service (Linux)

I need to Post a header that is slightly larger than 8k, and from what I've researched I can increase this by modifying the value of these fields: LimitRequestFieldSize & LimitRequestLine somewhere on my Apache Server.
The problem is I have a Linux Web App Service (PaaS) setup in Azure, and I don't know where or how to change these values in Azure.
Is it possible to do this if I have an Web App Service? If so, could someone help me out?
Many Thanks,
Kahl
I will answer in case others have this issue. There are a couple of senarious you could face on the Linux App Service:
If you using a gateway for your app service there are hard-coded limits, currently 32kb total, and 8kb field limits that cannot be changed.
If you have enabled "Client certificate mode" in the Configuration area, similar limits are in place.
If neither of these is the case, then set the header limits in the server you are using. For Apache, you create a custom startup script and specify LimitRequestFieldSize.
This appears to be harded coded on the azure servers and isn't possible to modify.

How to run multiple web APIs from same solution?

I'm trying to run multile Web APIs located in the same solution. One API i can acces with /client/1(project OtherApi) and the other API i call with /customer/1(project ConcurrentAPI). When i run the entire solution only /client/1 is giving me a response and when I try to call /customer/1 im getting an HTTP 404 error(look image).
I have already tried setting both projects as startup projects but this did not work.
Any thoughts?
Thanks in advance!
You try to run two processes that will listen to the same port.
I guess one of them will warn you that the port is busy.
So you may use different port in each solution, and then, access to each API using the appropriate port.

Service Fabric hosted Web API

I've created a simple Stateful Actor and a Web API (self hosted) and deployed it to Azure. It has worked and I can browse the nodes in the Service Fabric Explorer.
Azure gives me a url but when I add /api/values to the end (which works fine locally) it downloads a file called values and I can't open it as it is a binary file.
I want to call the web api from a Xamarin app (ie normal Rest api call) but if I can't call it via a browser I'm a bit stuck.
I would comment this on Stephen's answer, but I lack sufficient reputation.
To add a custom port to the Load Balancer after the service fabric cluster has been created you can (in the newer Azure portal):
Navigate to the load balancer resource for your service fabric cluster.
Under "Settings" find the "Load balancing rules" option.
This will have at least two rules, more if you did setup custom rules during the setup of the cluster.
Add a new rule.
Give it a name
'Port' is the external port you'd like to hit.
'BackendPort' is the port your service is configured to listen on.
The defaults on the other settings work in a pinch.
Note if you have multiple ports to enable, they each need their own rule.
I do know the above worked in my 'hello world' sandbox project.
I'm climbing the service fabric learning curve myself so I can't comment with authority on the other settings.
Have discovered what was missing.
https://azure.microsoft.com/en-us/documentation/articles/service-fabric-cluster-creation-via-portal/
This link here walks through creating the Service Fabric app on Azure and in particular the field "Application input endpoints" needs to have the port you want to use. For the samples, they are mostly port 80 or 8081.
There is supposed to be a way to add these ports afterwards which I tried (and so did a Microsoft support engineer) and it did not seem to work. You are supposed to be able to add these ports to the Load Balancer associated with the Service Fabric App.
I recreated my Service Fabric app, exactly as I did before but this time filled in the ports I want to use in the Node Type section and now I can hit the webapi services I've deployed. This field can be left blank which is what I did first time round and was why I had issues.
Not really related to Service Fabric, it's just how you set up your HTTP response headers in Web API. Recommend tagging this with asp.net or asp.net-web-api for a more thorough answer.
Tutorials and technical resources around Azure Service Fabric Stateless Web API tend to be slightly disjointed, given that the platform and resources are still quite immature.
This Stateless Web API tutorial, at the time of writing, is very effective.
As prerequisite to the tutorial:
Update Visual Studio to the latest version (Extensions and Updates)
Update the Service Fabric SDK to the latest version (Web Platform Installer)
Explicitly specify the EndPoint Port attribute (defined in ServiceManifest.xml) when setting up your Azure Service Fabric Cluster Node Type parameters
Following these steps will successfully allow deployment to both local and remote clusters, and will expose your Web API endpoints for consumption.

White list a program on Azure Database

I am working on a program that uses Azure for it's database. It works pretty good, except that I have to authorize every IP address that I access it from. So, if I go to a friends house I have to authorize that IP, and if I go to a coffee shop I have to authorize that IP...
I am hoping that there is a way to authorize the connection from the program, whatever IP it is coming from. Or, worse case senario, turn off that security measure.
DON'T.
The idea behind Firewalling your DB is to protect your data from anything that could have the SQL Server credentials should they somehow leak. It's for your own safety.
Instead, try to write a quick Web Service with ASP.Net WS/Jax RS/Rails/... to expose the DB data in a sane, secure and thoughtful manner. It's not hard and there are tons of tutorials and books on the matter out there.
Although NOT Recommended, but if you want to turn off this security measure you can allow connections to your SQL database from all IP Addresses by setting the IP address range to 0.0.0.0 - 255.255.255.255 in Azure Portal.
Another alternative would be to dynamically manage allowed IP addresses by using Azure Service Management API. You can manage Firewall rules using this API. You can read more about it here: http://msdn.microsoft.com/en-us/library/azure/dn505717.aspx
So what you could do is have a small service running in Azure. When your application starts, it sends the current IP address to your service and your service sets the IP address in the firewall rules. When the application terminates, it sends another request to your service and then your service removes that IP address from the firewall rule.
As #Machinarius so eloquently said DON'T. .NET already has a way of exposing data through OData services. You get SOAP or Json, LINQ queries, caching, security even down to the entity or operation level.
Exposing an EF model as an OData service is very easy. You can create an ASP.NET Web API OData endpoint using the "Web API 2 OData Controller with actions, using Entity Framework" template as described in the "Creating an OData Endpoint" tutorial.
To call the service from a client, you add a service reference to it and then use the proxy to execute LINQ queries. It could be something as simple as:
Uri uri = new Uri("http://localhost:1234/odata/");
var container = new ProductService.Container(uri);
var myProducts=container.Products.Where(....);
Check "Calling an OData Service From a .NET Client" for a detailed tutorial.
As an alternative, if you need to access your application from random places, why not have a VM configured in Azure with your application installed. And whenever you need your app, fire up that VM, RDP there and work via RDP. Would not need to update connection and much more secure rather then having to allow random IPs to access your database.
I realise this is not an answer to your question, but other stackoverflowers already provided a significant input on your problem. And I do agree with them all. Do not disable the firewall. It is for your own good!

Resources