Proxy - Application Insights - azure

I am using application insights on an on-prem server in our corporation. I have set up the key and everything works when I run it on my machine. However, once I put it on the production server, it does not work.
I have run PerfView to see what the issue might be. Of course, it is not making a successful http call to Azure. So I need to figure out how to set up a proxy for the Application Insights part of my application. Every tutorial that I have found only talk about how to do it for .Net Framework and not .Net Core.
Does anyone have some sample code on how to accomplish this?

https://github.com/Microsoft/ApplicationInsights-aspnetcore/wiki/Custom-Configuration#redirect-traffic-to-the-different-endpoint - You can override endpoint to any custom endpoint you have. Ofcourse, the code running in you endpoint should forward data to the original backend.
I dont think Application Insights allows user to specify proxy settings. You can have a proxy configured for your entire server, but not specific to application insights.

Related

How to make an API accessible all the time and not just when the project is executed?

I am making my first mobile app using Xamarin.Forms and FreshMVVM as the architecture and I want this app to get info off my SQL database (which is located in azure) by calling an API Rest. I already know how to develop an Api, and all the SQL and Azure related stuff, as well as how to get info from my API.
But what I don't know is how to access this API when the project in which is created is not executed, in other words, I don't know how to make my API Rest accessible all the time, so the App can access to it whenever is needed.
How do you do this?
Thank you all for your time, hope you have a good day.
You need to publish the API to a web host. Azure App Services. AWS. Digital Ocean VM running a web server. Possibly GoDaddy, though I have never used them. Your own server.

How to configure warm-up of web-service application within Microsoft Azure

On IIS I can configure my web-service with Application Initialization, AlwaysRunning and Preload enabled to make sure the first request is fast enough. Now I am trying to create a similar web-service within Microsoft Azure. However, the first request is exteremely slow. I tried to speed it up using "Always on", but this doesn't work. What configuration is needed to make sure the warm-up works correctly in Azure?
I would like to make Azure react the same way as IIS when restarting the application or refreshing the web.config. Besides the "Always on" functionality, I can't find the settings that are needed to do this. I have searched on other pages, but most solutions are about the warm-up of a website page. Is there a (simple) configuration to use for the warm-up of a web-service within an Azure app service?
Have you enabled Preload?
When you create the Web Service Application in azure...
Under Settings, Configuration, Path Mappings..

Running Angular5 app locally against Azure AD protected backend

We have an Angular5 application with a DotNet OData backend API. The application is hosted in a Web Application with a virtual directory for the Angular5 app and another virtual directory for the DotNet backend. The web application is secured by Azure AD, with an Azure AD Application defined for the web site.
This all works perfectly. We have no authentication code in the front end (except for 'withCredentials: true' set in the service calls) but apparently having the whole application protected by Azure AD makes the front end able to call the backend without issue (Azure makes you authenticate when you access the Angular5 front end).
The problem comes when we try to develop the front end. When developing Angular5 one needs to run the Angular5 code locally, so I've set up a web app which hosts only the backend code and point the local configuration for the Angular5 app there. This fails with the first backend call with a 401. One of our developers discovered that if you simply plug in the URL to the backend with the same browser (i.e. copy the failing call from the browser network developer tab into a new browser tab in the same browser) you will go through the authentication process and then when you run the local Angular5 app again it works. We thought we had found a workaround until we noticed that for some reason this only seems to fix the "read only" calls. GET works, OPTIONS works but POST fails with a 401. I put some debugging code in the backend but it seems this code does not even get called (i.e. Azure, not our backend, is blocking the call).
So I've tried to figure out how to get the local Angular5 instance to behave as the one hosted by the Web app but I can't figure out what I need to be doing. I have also been unable to find anyone else doing this so I can't find a solution.
I have tried various solutions of actively getting a token (e.g. setting up /.auth/me, using adal5 to "login", etc.) for the front end but it seems every possible solution is defeated by CORS in the end. Our backend has an Allow-Origin for localhost:4200 but this doesn't apply to login.windows.com for the authentication step. I tried putting localhost:4200 in the CORS setting on the Azure Web App but then it complains about an Allow-Authentication header being missing and I have no way to force Azure to provide that. I read online that this is happening because Azure didn't expect people to be using "cookie authentication" so after some research I found that "cookie authentication" was being used because of the "withCredentials: true" calls, so I changed all of those to false. Then the Allow-Authentication failure goes away but I just run into more CORS failures during the authorisation (login.windows.com).
So I'm really stuck here. I can't believe I'm the only person on earth who's trying to run a local instance of Angular5 against an Azure AD secured Azure Web app backend but I can't find any examples anywhere of people successfully doing this. I also would like to avoid having to do some elaborate local authentication because the code works perfectly as-is when hosted on the same Azure Web app as the backend. Does anyone have a setup like I describe that is working?

Correct way to deploy a Restful WCF service

I've created a simple RESTFul WCF service that returns JSON formatted data.
This works swimmingly when I'm hosting it in my dev environment.
I use the following uri format:
http://localhost:8732/Service1/GetMetric?RunNumber=49653&MetricName=Res_Side_Coeff&SampleNumber=2
My problems begin when I want to host it on a server. If I publish it, an svc file is created. This is no use as I have to create a wsdl, which is fine for a VS C# project to bind to, but not for me as the consumer of this is going to be an external, non c# tool. Therefore I just want to keep the access to it exactly the same as when in development.
How do you deploy to an IIS server (8.5) to achieve this and what configuration settings do I need?
I decided to try to create a WCF Service application rather than a library, this works fine, though I still dont know why the library doesn't work.

Setting node.js site to auto-start when hosted in Azure Web app

I have a Node.js script that I want to run in Azure on a Web app.
This script is not an express web site, rather it's a worker script which polls a database for work to perform, and when done it just polls and waits, e.g. there is not user interface for it.
I notice that after deploying it, even though it's setup with iisnode, it won't actually start until I fire up a browser and navigate to the Azure Web app host, even though it doesn't have a UI.
Only when I navigate to it does iisnode start logging and fire up my application. Then it happily polls the database and performs the required work.
Does anyone know how you can make a site just automatically start when deployed?
There seem to be autostart web.config settings available with IIS, but I don't know how to get iisnode or the Azure Web app to support it.
I could set up a Web job on the machine that just performs a GET from the site, but that seems a bit of overkill and messy.
You can leverage Function App to satisfy your requirement. Also, your original solution which build an Azure Web App without UI should be work.
However, please pay attention that Azure App Services will be unloaded after they have been idle. You can enable the Always on application setting to keep the app loaded all the time. Please refer to https://azure.microsoft.com/en-us/documentation/articles/web-sites-configure/#application-settings for more details.
Any further concern, please feel free to let me know.

Resources