Application Insights - No data for dependency duration - asp.net

I am not getting data for any dependency calls (Azure SQL calls) in one of my clients' Application Insights which is running an Azure Web App. Initially, I thought the application is on older version of .Net (4.0), and then I created a sample Azure Web App with the latest ASP.NET 5 template with Azure SQL as database. Even for this one, no dependency call related data in Application Insights. Both the applications have been deployed successfully in Azure and I am checking the Application Insights data in the Azure portal. Any clue what is going on ..where should I check?

Please make sure you have Microsoft.ApplicationInsights.AspNet v.1.0.0-rc1-update3 installed (not that 1.0.0-rc1 that is default with VS2015). v.1.0.0-rc1-update3 should also install Dependency Collector module, so you should have HTTP/SQL dependencies collected by default for full framework. Just verified this is the case.

Related

Not collect SQL dependencies in TEST environment

I published my project, which uses Application Insights, on an IIS server. The files I published are: all DLL from Application Insights, the script tag for collects http requests from the view that i want to track, and the applicationInsights.config with the intrssumentation key in it.
The issue is that not collect SQL dependencies. But the interesting thing is that when I run the project in Visual Studio it collects all the dependencies including the SQL dependencies.
In this case, what could be the problem? a configuration issue on the server? something missing from publish to server?
If you're seeing them collected locally while debugging, but not when deployed, then chances are you have a different version of .net or the AI sdks installed in the 2 places, or you're missing a required library when you deploy? make sure your deployed items are the same as your local dependencies?
see: https://learn.microsoft.com/en-us/azure/azure-monitor/app/auto-collect-dependencies
for a bunch of the details about versions and packages, etc.

Application Insights picks up SQL telemetry locally but not in a real environment

Generally I've had pretty good luck with Application Insights' auto-detection of a SQL dependency. However, in a recent case where we added Application Insights to a Web API project, we are not seeing dependency tracking for SQL Server in the portal. Version info:
Application Insights 2.5.0
Entity Framework 6.x
.NET 4.5.2
The funny thing is that Azure will automatically pick up SQL calls when developers are using the debugger from Visual Studio. What do we need to do to capture timings for SQL calls on a real environment?
Thanks,
BGU
The solution was to upgrade the Web API project to a more recent version of .NET (4.6 or higher). Good luck out there.
https://learn.microsoft.com/en-us/azure/application-insights/app-insights-monitor-performance-live-website-now
Dependency diagnostics like full sql command text will be available in Application insights only at runtime. If web api project is hosted on IIS server, then try integrating your web application virtual directory to app insights resource using status monitor. Once you do that, it will push full sql command text to d app insights portal.Comparison Build time and run time integration

Deploying ASP.NET Core solution with class library to Azure

I'm working in VS2015 and have a ASP.NET Core solution with two projects - an API Web Project and a Class Library that holds all the data entities, context and Entity Framework migrations. The API project references the class library and all works well on my local machine.
I now want to deploy the solution to Azure and this is where I'm hitting the problem. If I right click on the API project and go through the Azure App Service publish wizard, on the Settings tab I expand Databases and the message is "No databases found for this project" - which I'm guessing is because it can't find a context as it's not in this project.
If I do the same on the CL project though, there is no Azure App Service deployment option, the only option is File System and clearly there's no option to create the database there either.
So, in summary, my question is how I can deploy this type of solution to Azure and have the database created and migrations applied?
I think you need to create the DB first in the azure and then try to publish your application through the wizard. The database is on your local machine and the application will work just fine on your local environment. But on the cloud you have to first create the database on Azure SQL. Then you need to get the SQL connection string from the portal and update your config file accordingly. Once this is done you can then publish your application from Visual Studio. Please note that the wizard will still not show you the databases, but the application, when configured properly will run fine.

Web Deploy Package containing output from Web Application and Database Project

In my organization the main product is a web application and an associated database. Both the web application and database is source controlled in TFS. We are running this product in various versions across hundres of IIS web site instances. When having that many web site instances on IIS deployment is atm. a problem.
What I want to do is to package my web application together with the output from my database project. I've been looking into creating a Web Deploy Package which makes it easy to deploy a web application remotely, locally or programitically to IIS if i want to.
What I want to achieve is to have one package but I want to know if it's possible to embed a Database project into a Web Deploy Package taking advantages of dacpac incremental database deployment?
If this is not possible is there any good alternatives to Web Deploy Package that suit my needs?
Another method is to create an MSI package to deploy both the Web Deploy Package and also update the DBs. For example, with Advanced Installer you can use the built-in support for Web Deploy Packages.
To perform dacpac incremental database deployment you can call SqlPackage.exe from the same MSI, as a custom action. The linked example shows a simple EXE running, but you can change that to run any desired EXE, passing your required command line parameters.
If you perform frequent upgrades of the websites, or the settings are usually changed after the installation/deployment, then you should take a look at the next thread too, it talks about persisting website installations during upgrades.

Deploy to an Azure WebRole without Visual Studio

Is there a way I can deploy my entire website/webapp to an Azure WebRole without the need of Visual Studio?
Context: We have a test environment where there's an IIS hosted web app where our testers test (of course). The thing is, we want to grab that exact tested web app folder and deploy it "as is" to a WebRole.
Please avoid commenting on our procedure, we have been looking at it and we will eventually change it if we have to, I just need a 'simple' yes(how)/no answer.
IIS Web Deploy can be used to package/migrate/restore IIS applications. It can be enabled while deploying a web role as described in this article and allows to update the web role with the application as deployed in your test environment.
Be aware that only single instance cloud services are supported and that in case of a maintenance operation by the fabric controller, your service will be rolled back to the state created by the initial azure package deployment. (There once was a tool for syncing between multi-instance web deployments but sadly that did not work out too well and is no longer supported. Do not attempt to use or rebuild it.)
Installing and Configuring Web Deploy shows the steps to get web deploy for your local testing IIS while articles on using web deploy like this one show examples for calling the tool.
Another option to evaluate are azure websites and git deployment. This could provide you with a documented and reproducible form of deployment that is not prone to unwanted rollbacks while allowing the service to scale to multiple instances. This option might not work out if the application it too tied to the web roles infrastructure or contains code not suitable for the more restricted web sites environment.
A third option to look at is using CSPack as presented in this article. You basically create a service definition and package up the webapp manually without building it in Visual Studio or TFS.
Yes - make sure you have enabled Remote Access on your webrole. Then copy your web app from your local IIS folder to F:\sitesroot\0 (NOTE - may be E:\sitesroot\0 on same web roles).
Yes, you can write a programmatic interface against Web Deploy from your C# code. If you're deploying to Azure Web Sites, you could also use the Windows Azure Management Libraries to spin up new web sites or clouand deploy them.

Resources