WinJS App - Not able make ajax request using WinJs.xhr - win-universal-app

I'm developing a simple app using WinJS for Windows 8 and 10. The app makes an Http request using Winjs.xhr.
I developed Web API hosted on a server with CORS enabled into that. Now, when I install my Win app in development machine (where API(s) are hosted), Win App is able to download the data.
On remote computer it fails. It executes error code block and returns readyState=4, status=0.
See detail description of problem I'm facing here

Finally Solved after spending my 3 days behind this searching everywhere.
I have been using http://192.168.4.134:9084/.... URL for sending the request. Initially, I had set app capability to Internet(client) and Internet(client & server). Later while rethinking I realized that since it's routed through network, I may also require Private Network (Client & Server) to be checked marked.
for now this has solved the problem, and created a question that "Do I need to check mark it when I will publish it for store?"
Another off topic question, How to sideload this app in all computers at once assuming that all those PCs are connected with single AD server under one domain?

Related

How to create a HTTPS tunnel on my vps for my twitch bot event listen

I found an example on how to use the twitch EventSub webhooks(https://github.com/twitchdev/eventsub-webhooks-node-sample/blob/main/index.js) but i'm struggling with finding out how to setup it up without having to install ngrok or other apps on my PC since i have a vps where i host the bot. I understood the GET method but POST is a bit difficult for me.
Hope i explained it well enough for someone to understand.
Twitch EventSub at time of writing only offers a "Webhook transport"
So you should be able to set this up no problem on your VPS, since your VPS is web accessabile.
To test this locally on your PC yes you will need a proxy/tunnel such as NGROK to make your PC web accessable.
A "webhook transport" (to over simplfy) operates in the same way a login from on a Website does. You fill in the form and hit submit, and the form is POST'ed to the server.
Webhook's it's the same thing, except the data isn't POST'ed as a form but a JSON blob in the body.
So you can use anything capable of receiving a HTTP POST. There are just a few NodeJS examples like the one you have linked kicking about.
TLDR: unless you are testing, skip setting it up on your PC and start with setting it up on your VPS, as the VPS doesn't need a tunnel, apache/nginx are the SSL Terminator that passes to your Node script, if you use a node script link the linked exmaple in the OP

App Service HTTP/2 Not Working

I have HTTP Version set to 2.0, but App Service is acting like it is not.
I'm using https://tools.keycdn.com/http2-test to test and it says Negative! <site> does not support HTTP/2.0.
Chrome is also using HTTP/1.1.
It looks like this is affecting all apps in the App Service Plan. I have 2 currently and neither have working HTTP/2. I added a third and it doesn't support HTTP/2 either. I have HTTPS setup on both apps and my requests are using HTTPS.
I've tried all sorts of combinations of changing the setting and restarting. I've tried stopping both apps and then restarting them.
I contacted Azure support and they found an issue with the server my app service was hosted on. They were able to fix the issue and it is working now.
I test in my site and get the same error message with you. However after waiting for serveral minutes, it will turn to HTTP/2.
As you have tested, go to App Service's Application Settings and set the HTTP version to 2.0. It may caused by the response delay.
If you want to ensure it, as Zahid said, you could refer to this blog to check if the http20Enable attibute value is true.
Azure is just starting releasing the full HTTP/2 support.
HTTP/2 is supported as HTTP Server on AppService but the ILB (Reverse-proxy) router doesn't support on the client side the HTTP/2.
So the HTTP/2 is not available end to end because of the internal reverse-proxy (ARR) but they are migration on YARP Project with support HTTP/2 and gRPC.

Owin selfhost - dont allow connections from external machines

I have a c# app that runs as "server" for a client app (Electron).
The c# does the data crunching and serves the data over HTTP to the JS client.
The webendpoint is implmented using Microsoft Owin and WebAPI.
It works very well, however, I do not want the port to be bound on the network interface at all, only on the "loopback".
The binding is done as described in owin docs as
WebApp.Start<MyConfig>("http://localhost:10000");
I choose a high port number to avoid being Admin.
This works well, however, the port is open from outside too, albeit, http requests from outside are rejected with bad request (which is good for me), but i dont want to bind at all.
I cant seem to find anyway to do this, any idea ?

Need to access my VM Windows 8 Local IIS from my Mac OS X host machine

I'm doing all my mobile development on my Mac OS X (Xamarin Studio or native languages), and using Parallels to work my Microsoft Azure Mobile Services backend in Visual Studio.
I've came to the point I want to test my Azure Mobile API, but I don't want to publish the service for every change and also debug it.
My problem is that I deploy to my IIS, express or local, works fine in terms of seeing the land page of the API on my Mac physical hosting machine but as soon as I click try it out I get an authentication message, check screenshot, I don't want any security to be applied right now.
How to disable it and test my Azure Mobile Service API from my Mac and eventually from my mobile projects.
[EDIT]
I should mention that from my VM Windows 8 the IIS is running properly and I can access the API without any username/password.
[EDIT 2] From #lindydonna answer.
The proxy seems to working fine since from my Mac I can call localhost/MyApiService and it goes to my Windows 8 VM Local IIS server.
So I have access the API server, all the controllers and their endpoints, you select an endpoint and get the sample screen, click try it out and fails to complete the HTTP request, 404/NotFound error. See screenshot.
The BODY of the GET request in this gist.
The above is a problem in the Local IIS settings since the same behavior applies in the Windows 8 VM environment when trying the Azure Mobile Service test page.
I made it to work using Postman, it returns JSON data properly, the iOS simulator doesn't seem to work with localhost. The MobileServiceContext throws an exception when trying to pull.
protected virtual async Task PullAsync (IMobileServiceTableQuery<TEntity> query)
{
try {
await Initialization;
IMobileServiceSyncTable<TEntity> entityTable = GetTable ();
await entityTable.PullAsync (typeof(TEntity).ToString (), query); // <-- The System.Net.WebException thrown here.
await entityTable.PurgeAsync ();
} catch (MobileServiceInvalidOperationException preconditionFailedEx) {
Debug.WriteLine(preconditionFailedEx.Message);
}
}
The problem is that your IIS Express instance is configured not to accept external network connections as a security precaution, and the Parallels VM is considered a different machine.
The easiest solution is to follow this Fiddler tutorial: Configure Fiddler for Mac, which will set up Fiddler as a proxy on the VM.
Then, on your Mac, you should modify your network settings and add a proxy setting that connects to the Fiddler proxy (http://docs.telerik.com/fiddler/Configure-Fiddler/Tasks/ConfigureForMac#configure-mac-). Your iOS simulator will pick up those proxy settings.
NOTE: the Fiddler setting opens up a port on the VM, which you should turn off once you are no longer using it, as a security precaution.
Also, according to this response (iOS 8 / Xcode 6 Simulator is not using HTTP Proxy anymore) you need to also restart your iOS simulator so that it picks up the new settings.
Leave the username blank and use your Application or Master Key as the password.
Also answered here: Authentication for Azure Mobile Web Services test pages

Debugging all HTTP[S] on node.js

I'm having fits accomplishing something and after scouring google & SO, throwing my hands up after a few days. Trying to do something that I think is pretty common: debug / examine all HTTP traffic while developing a node.js app.
In Windows it is as simple as firing up Fiddler and I can see all HTTP & HTTPS traffic from all processes. But I've switched platforms over to OSX and trying to make the same work.
I've tried using Charles & MITMPROXY, but all I'm seeing is the traffic to, with the response, my node.js app. My node.js app is calling external services, some using the popular request package (which I have seen how to set that up) but also using other packages, like azure-storage. What's troubling me is I can't get any of the debugging proxies to show me at the azure-storage package is sending / receiving to the endpoints they are calling.
Conceptually I think I get it... I have to tell these different things (like node.js, request & azure-storage) to go through the proxy each of these tools uses... but how can you do that without modifying their source? Can't, like how Fiddler works on Windows, you do something to "all traffic goes through this proxy"?
I'd use Fiddler on OSX but it is currently not working with no ETA in sight after talking to Telerik.
So the problem I was having is what I thought... in my specific instance the module that I was using to access Azure storage was not using the default proxy. I found a package (**global-tunnel that hijacked everything that used the request package to control it going through a proxy. Now I saw stuff show up in the HTTP debuggers I was using.
The problem now is when I am trying to reach an HTTPS endpoint... using something like Charles, it used it's own SSL cert which wasn't trusted by Azure so the connections were refused. Back to the drawing board...

Resources