Application Insights Codeless attach Status Monitor V2 - c#

im using Application Insight Codeless Attach over IIS with Status Monitor v2.
Everything works great, the only thing is that im not able to see SQL CommandText over the insights.
In addition to the platform specific steps above, you must also
explicitly opt-in to enable SQL command collection by modifying the
applicationInsights.config file with the following:
The application folder does not have any applicationInsights.config file so is not possible to add the following:
<EnableSqlCommandTextInstrumentation>true</EnableSqlCommandTextInstrumentation>
I've also tried to change the ApplicationInsights-default.config and ApplicationInsights-recommended.config files under "ApplicationMonitor\version\content\runtime" without success.
Does somebody know how to add this property without code implementation?

As this doc mentioned, IIS server need to use Microsoft.Data.SqlClient instead of System.Data.SqlClient.
requires using the instrumentation engine or by using the
Microsoft.Data.SqlClient NuGet package instead of the
System.Data.SqlClient library
===========================Test result=====================
I created a test asp.net core mvc app and used Microsoft.Data.SqlClient, after deploying to azure web app and enable application insights, I can see sql query text like below.

I get it working without using Microsoft.Data.SqlClient and without a single line of code in the application. Just using status monitor v2, enabling instrumentation and adding -connectionstring instead of -instrumentationkey or -instrumentationkeymap. The problem with this approach is that when you deploy an app looks like the instrumentation service stop getting the sqlcommandtext until you restart it –

Related

Deploy a net6 mvc web app on iis using webdeploy package

I created a web delpoyment package using the "Web Deploy Package" wizard from Visual Studio 2022.
The output is a web package and a cmd file to configure.
My goal is to install the package on a remote server as new application with a custom new application pool. A default web site already exists.
I got this working using parameterization
webpackage-deploy.cmd /Y /M:iis-machinename /U:user_name /P:user_password
The issue is i always get the default application pool.
What i have already tried was to add
<IncludeAppPool>true</IncludeAppPool>
<IncludeIisSettings>true</IncludeIisSettings>
to the pubxml publish file. This lead to a custom parameter, which gets ignored when i install.
-enableLink:AppPoolExtension
which also made no difference.
Looking inside the webpackage in archive.xml the deployment is alsways a IISAPP. As much as my resarch went the IISAPP can not assign a application pool.
I also found the apphostconfig provider, which in my case didn't work because i have to specify more parameter, e.g. the physical path which i do not want to configure while installing (the IISAPP uses the inetpub/wwwroot folder which is what i want to achieve )

Automatically update local client website that running on IIS manager

I have a website that running locally on IIS Manager. Every time when I update website, I communicate client via Anydesk and update its file. Whenever the client got any update from server than it should be automatically updated.
I got it solution to push dll file on GitHub. When customer click on update button GitHub file download automatically in where website hosted folder. The problem is here when I replace updated file, it will give an error 'The process cannot access file, because it already used'.
If this solution is correct, kindly guide me how to overwrite file while application running on IIS manager without stop application
Otherwise give me suggestion to update file from online window server to local IIS manager without closing application.
Currently, in ASP.NET Core apps, it is impossible to replace binaries when the application is still running, but it will possible in .NET 6 by Shadow-copying in IIS.
You should consider the Blue Green deployemnt for your app https://docs.cloudfoundry.org/devguide/deploy-apps/blue-green.html
Options that I can suggest for your:
Move app to the cloud provider and use their features. For example Azure has Load Balancer/Traffic Manager/Slot deployment that can solve your issue
You can play with IIS Load Balancer: https://learn.microsoft.com/en-us/iis/web-hosting/scenario-build-a-web-farm-with-iis-servers/configuring-step-3-configure-iis-web-farm-load-balancing#:~:text=To%20configure%20load%20balancing%20with,Open%20IIS%20Manager.&text=Under%20the%20server%20node%2C%20expand,list%2C%20and%20then%20click%20Apply.

Is it possible to edit a project once is published on Azure?

I'm testing an application I just published using the free option that Azure gives us.
In this process I found out that I need to make a change to a Controller (ASP.NET Core 2.0) and I've been looking for the options to do so.
I've encountered with Azure App Service Editor and I'm reading some documentation about it. However, it does not seem the way to do this kind of change since I can't access the *.cs files thru this service. This is the list of files that are shown:
So, my question is:
Is there a way to edit these files (controllers, views) with Azure App Service Editor?
If no, what would be the way to reflect this changes on my already published application? Also, in the case the answer is "republish the project", is it possible to do so without alter the information contained in the database that has been added during this test process and only update the modified files?
I apoligize if these questions are very basic but I'm just getting started to know about Azure. Thanks in advance.
How I publish it:
In order to publish this project I used the option Visual Studio gives us:
Now, if I go to the same option, this windows shows up:
Question: If I hit the 'Publish' button I believe it will republish, the whole project, correct (the database included)? If this is the case, I believe there will be conflicts about the databases, since I have already information in the project published and other information in the local project. Is it possible to reflect the update for everything but the databases?
No, you can't update the files there as this is a compiled web app, so you have to publish the update.
I'm assuming you're using EntityFramework and originally publishing the database via the web publish.
If you click "settings" on the publish dialogue, on the second page (settings tab) you'll see the options for publishing the database.
Here you'll see options as to whether to update the database during deployment, this I believe is to apply migrations. But if you uncheck these it should not update your database at all.
You should verify this after saving the publish by looking at the generated publish profile (you don't have to do a publish to see this)
It will be located at "YourApp\Properties\PublishProfiles" and should have been added to your solution, and will be called something like "Your App - Web Deploy.pubxml"
Within this you will see a <PublishDatabaseSettings> section, where the Enabled properties should be set to False
However I would advice that before publishing any update:
Test the deployment to a new server
Back up the database before deploying and test you can restore from it.

mvc4 vs2010 iis7 - set server auhentication

so my problem Erises as i refuse to advance nor to vs2012/15 nor to mvc 6 i think is the latest and nor using EF... well latest.
as the configuration i am in :
windows 7 .net 4.03... mvc4 iis7
i have a problem adding a new website/application so i could simply publish using built-in arrangement via vs2010... instead..as i did with webforms(my till now approach) copying source to wwwroot by my self.
so the issue is i can not find any article /tutorial to set it correctly as the guidance is to set via web platform referencing this age of versions is via using older Wplatform that has Install Web Deploy - via using option in list "Recommended Server Configuration for Web Hosting Providers" which does not exist in current wplatform...
update i forgot to mention i did not want to set any kind of athuresation till i know what will be the effect and what problems in connectivity to the application it will apply from other hand how easy will it be to hack even via spoofing no sweat
as it seems the problem till now was the access permit to the folder of the project i suggest to not use the vs studio as the folder of the project but to make a copy on a normal directory otherwise u need to set user as the user of iis asp.net iis/nameofpool and give it a read right ...full rights accessing the folder.

Update Javascript libraries when deploying a web application to Windows Azure

I have an MVC4 web application that uses jquery and some other libs (jquery-ui in particular).
Yesterday I decided to update all the packages via NuGet package manager; my web application worked correctly on my local machine, but when I deployed it to my azure website a javascript error popped out in my browser (it was related to jquery-ui library, something like "$browser is not a function").
I searched the web and found out that the cause of this error was that I was still using an old version of jquery. It seems that deploy process didn't publish the new version of the js libraries even if they have been updated in local project.
I solved the problem connecting via RDP to the Azure machine, deleting the contents of "Scripts" folder and deploying again, but I'm wondering if there's a way to "force" script/libraries update when deploying to Azure.
Edit 1: I'm developing with Visual Studio 2012, using Mercurial as source control provider
Edit 2: I'm deploying to Azure Web Sites
Please, in your future questions clearly indicate what type of Azure Service do you use. An MVC4 web application can be deployed to 3 different type of services: Azure Web Sites, Azure Cloud Service, Azure Virtual Machine!
Since you are talking about RDP, the viable options are Cloud Service or Virtual Machine. But then you say
I solved the problem connecting via RDP to the Azure machine, deleting
the contents of "Scripts" folder and deploying again, but I'm
wondering if there's a way to "force" script/libraries update when
deploying to Azure.
Now the question is how you do deploy to Windows Azure? Is it via Visual Studio's Publish feature to Azure Cloud Service. Is it Visual Studio's Package feature and then using any other method of deployment (upload the package from the portal, use Azure PowerShell cmdlets, or use third party tool to deploy the package)? Is it integration with Mercurial and deployment is done automatically when you check-in?
Any any case, the issue you face is a mixture of NuGET failing to do real clean update of everything. Browser caching - especially for local development - IE caches all the scripts, CSS and images and it is hard to say (without explicitly deleting all locally cached files) which script are you actually using. Simple version control issue - keeping old and new scripts.
When you do a JS/CSS updates I strongly advise all the customers to first delete all browser's cache (crtl+shift+del - works for all browsers) before testing locally.
I highly doubt that if you use a Cloud Service, RDP-ing and deleting anything in the sitesroot folder will help you when you redeploy. What you do in the ROLEROOT drive (usually E:, sometimes F: drive) is dropped of/forgotten when you re-deploy regardless of the re-deploy method you use: in-place-upgrade or full re-deploy. So what you did is actually creating new package and re-deploying your new package.
The fact that you deleted some folder has no effect on your re-deploy action.

Categories

Resources