When the changes in ApplicationInsights.config apply? - azure-application-insights

If i edit applicationInsights.config file on working application (or replace whole file), when the changes apply?
Does it happen immediately or I have to restart my application?

The ApplicationInsights.config file contains names of classes to load, etc, so it is only read on startup of the app.
You'll need to restart your app pick up any changes.

Related

How to Clear/Delete BrowserContext folders?

Using JXBrowser 6.14...
I'm using a different context for every Browser instances, that means I'm creating a temp folder for every Browser instance that I have, I've decided to remove this temp context folders when the Java application shutdown the problem is somewhere this context folders still being used for JXBrowser so I'm not able to delete them. I've also used deleteOnExit() but I'm still facing some problems with some files.
So, I'm wondering is there a way to clean up all those context files/folders? probably when the Browser disposed...?
Thanks in advance.
Before you start deleting this folder, make sure that you dispose all Browser instances with BrowserContext configured to use this folder. If you have at least one running Browser instance that use the folder, you won't be able to delete it.
Also, make sure that you first delete all files inside the folder, and then remove the folder (empty) itself. As far as I know Java doesn't provide API that allows deleting folder with files inside. At least 1.6. First you need to delete each file.

Deployment of published code?

I published the code with Visual Studio 2010 and then deployed the pulished code on production server.
Everthing is working fine.
Suppose if I need to make some changes in code behind file (.cs file). Do I need to publish the code again and again from visual studio 2010?
Or Can I just need to replace the bin folder on production server?
Currenlty I publish the code each time I change the code in code behind file and replace the publish code on production server.
Your bin directory will contain your compiled code so if that's all you change you can only deploy the bin folder.
But when you change other files, like your web.config, aspx, css or javascript files, those changes will not show up in your bin directory. Those physical files will need to be deployed.
Because deploying can be a tedious and repetitive process, it would be best to automate this. If you setup your webserver for WebDeploy, you can automatically deploy from Visual Studio to your server. WebDeploy will keep track of all changes and make sure they are deployed.
if you chage .cs files only, then you can replace dll files.
when you publish:
If you choose Replace matching files, it copies only changed files
it is equal to replace dll as above and also it is better option than doing it manually.
sometimes we may have changes css or javascripts but forgot to add them.
If you try to modify the code behind code, you don't have to republish the whole project and just need to override the production files. Because it is a partial class of aspx page and is compiled at runtime.
But it is better to do it automatically using some tools. It can avoid human mistakes and run your test to make sure your change doesn't break any functions.

how to package/publish a PDF for deployment?

i'm trying to package a deployment for Azure, but it is not packaging some files that are needed for the app to work properly. Those files are mostly PDFs and DOCXs.
If I go to the Package/Publish settings I have 3 options:
1. Only files needed to run this application. This is the default option which is excluding the PDFs and DOCXs.
2. All files in this project. This is including the missing files, but it is also including the code behind files (even though they are compiled). I do not want to include those files.
3. All files in this project folder. Haven't even tried this one because it will probably be worse than option 2.
My question is how do I set which extensions are actually needed to run this application?
Right after posting this question, I figured it out. For any out there with the same or similar problem here it goes...
In order to include certain files in the deployment package you have to set build action of those files to Content. Just right click on the file in solution explorer and click Properties. There change the Build Action to Content:
Also, you have to set the the setting of the Package/Publish to "Only files needed to run this application". The default option.

Can MSDeploy deploy only new or changed files?

I intend to use the web deploy feature of ASP.NET 4.0 for my site. Does anyone know if this feature does incremental deployments (i.e. only deploy changed or new files in the solution)?
Thanks
MSDeploy does deploy only the new or changed files by default. But I've stumbled upon this question when I had found that for me it wasn't the case. I was using Angular CLI that copies the assets folder as-is, but file dates are lost on the way. And MSDeploy by default uses file dates to determine if a file had changed.
Here I've found a way to force MSDeploy to use checksums instead of file dates. You just need to add <MSDeployUseChecksum>True</MSDeployUseChecksum> in your first PropertyGroup in your .pubxml file (publish profile). Or, if you don't use a .pubxml file and use msdeploy directly instead, just supply a /p:MSDeployUseChecksum=true argument when invoking it. Works like a charm for my temporarily slow internet connection: reduced the deploy from 10 minutes to 10 seconds (most of the assets never change). Yay!
Yes it does. It is really fast, also for solutions with many directories.
I've seen the deployment time of a big solution being reduced from 30 minutes to about 5.
For smaller projects, the incremential deploy is done within seconds.
Edit:
Due to several call backs: Have a look at this screenshot:
Check out the radio buttons. (The image is taken from an article about web config transforms, that I've written in the past. Check out this link if you want to see the context of this screenshot)

"Add as Link" for JavaScript files returning 404 in debug

Using a Visual Studio 2010 ASP.net web application, I have several projects that share some JavaScript/css files. The most logical way for them to share these files is to place the files in a single folder and each project has them included with the "Add as Link" option. However, if I add the files this way when I'm debugging using either the Visual Studio Development server or debugging using a local IIS web server all requests for these files return 404 Not Found errors. If I publish the site then the files are copied but that obviously doesn't help with debugging.
Is there something I'm missing or is this a failing on VS's part?
To overcome this problem some time ago I created a 'MSBuild.WebApplication.CopyContentLinkedFiles' nuget package. This package adds MsBuild target which copies all content files added as link to project folder during build.
Note: if you use source control then it is better to add copied files (from Web Application folder) to ignore list.
I wouldn't really call that a failing, since you asked for that behavior in the first place: linked items in Visual Studio projects are actual links to external files. Those files can reside anywhere on the disk and are not copied into the project folder.
You might want to copy those files locally yourself during a pre-build event. That way, the files will remain synchronized and you won't duplicate them until your first compile.
The problem seems to be that the website runs right from your source folders, rather than from the bin folder. This means that the file will be missing, whether or not it is copied to the output folder.
It's probable that running from a local or remote web server would not have this problem, though I didn't get that working, and I'd rather not add IIS to my local machine if I don't have to.
Adding a pre-build copy command did work. Note that the current directory will be the bin folder. (You can use cd to echo the current directory to the build window if you want to see it):
If the file is in another solution, your command will look something like (three ..s: one to get out of each of bin, project, and solution folders):
copy ..\..\..\OtherSolution\OtherProject\Scripts\MyJSFile.js ..\Scripts\
If it's in the same solution, but a different project:
copy ..\..\OtherProject\Scripts\MyJSFile.js ..\Scripts
One minor issue is that the link to the file will collide with the new copy of the file, even if you don't add it to your project. As long as you make the link first, it seems to work. If you copied the file first, you'll have to manually delete the copy, and then refresh the solution explorer before before being able to add the link.
Select the link in Solution Explorer and then look at properties window and set Copy To Output Directory to Copy Always. Linked items are set to Do Not Copy by default.
BTW, you can copy many files as links very easily directly from Solution Explorer when using VSCommands 2010 extension.
See this blog post about a simple addition to your project file.
http://mattperdeck.com/post/Copying-linked-content-files-at-each-build-using-MSBuild.aspx

Resources