IIS Http Module config file write auto creates .bak file - config

I've got a custom http module in IIS 8 that uses a set of config files to control how it works. These are all named *.config and are mainly in a filesystem folder outside the scope of the site, with one in the bin folder.
In the module I use system.io.file.writealltext to update the files. When I do this, the file I'm writing to is copied to a .bak file before the new file is written to. This only seems to happen when the file extension is .config (I've tested with other extensions and it doesn't happen).
It also doesn't happen everywhere - it happens with all the deployments I have on an Azure Windows Server 2016 VM, but doesn't happen much on other deployments (we have clients with a variety of versions of Win Server & IIS).
I suspect its an IIS setting, to automatically create a .bak when a .config file is changed, but can't find any info on this.
Does anyone have any idea why this is happening and how I can turn it off?

Related

FileZilla Not Responding when accessing App_Data folder containing an MDF file

I am having a strange issue with FileZilla client Not Responding (Picture attached) exclusively when accessing my App_Data folder in an asp.net website which contains a mdf file (SQL Database file). The folder I'm trying to access is on my local machine. I do not have any issues with viewing any other file types.
I am running the newest version of FileZilla client (3.34.0), I have tried reinstalling. I've also tried deleting the files in AppData/Roaming/FileZilla to see if that was the issue. I've checked my crashdumps in AppData\Local\CrashDumps, and there are no dumps. I've also made sure all SQL services are not running in case the MDF file was somehow in use.
I've searched around the web, and haven't found anyone with the same issue, and as a temporary solution have to use Windows file explorer to manage my FTP for this site.
Has anyone had a similar issue, or have any ideas of what I can try next? Any help is appreciated.
FileZilla Client not responding

How to copy an *.exe file from one computer and paste it to another computer over LAN

For example I have a client-server application, this application often gets updated (it's an exe file). If I download the update on the server machine then the same update should be transfered to the client machines, or vice-versa.
At the moment the update is downloaded on all machines individually. My idea is downloading the update should be done only on the server and I'm planning to make an option in the client to copy the *.exe file (update) directly from the server and paste it on the installation path.
How can I make this happen?
NOTE : the update is a self extracting file.
There is already a technology for achieving this called ClickOnce. The client application can be "published" to a share that is accessible to all the clients, then each time the client is executed a version check is done - if a later version is detected on the share then it is downloaded before execution continues.
You can read more about this here: ClickOnce Security and Deployment. Creating a ClickOnce package and publishing it is a feature already built into Visual Studio, so you do not need to write any code.
You have to write an application that will be split into different parts :
Detect file change either on the client or server machine
Perform the copy of the exe file to server or other clients.
In all cases you can't tell an exe file to update it self.

Zend server CE - Will not load .php file rather downloads it

I installed Zend Server CE on Windows 8. When I try to load a .php file in my browser it does not load but downloads the php file instead.
My root for the server is C:\Program Files (x86)\Zend\Apache2\htdocs\
I looked everywhere on the web but there is no documentation.
I would recommend against having your document root in program files because of all the security. Reinstall it outside of program files and it might/will probably work.
How do you invoke the file? You cannot use the full windows path there ie: c:\Zend\apache2\etc.. But probably localhost/yourfile.php or 127.0.0.1/yourfile.php. Can you open zend's interface at localhost:100081?
If you get a internal server error well then it serves php files. Now enable errors in php.ini and find out what is wrong probably some path. You are getting a php error and they are set to not display so you get the server error. That does mean php files are parsed by apache and not downloaded. This question here on so has pretty much what you need to configure.
Just remembered you had the zend-framework tag so you could check in application.ini for error handling settings.

Configure Azure Cache (<dataCacheClients>...) of WebRole in cscfg file?

Currently, I have my Azure Cache configuration
<dataCacheClients>
<dataCacheClient name="default">
...
inside my Web.config of my Azure WebRole. I would like to be able to easily modify the Azure Cache settings after the cspkg package has been created, i.e. I would like to move the configuration into the cscfg file.
I don't think that's possible without hand-coding all the possible configuration options of Azure Caches (and then interpreting those options and setting the configuration programmatically in the DataCacheFactory). Am I overlooking something?
in webrole (RoleEntryPoint derived class) onstart, you could overwrite web.config caching part with the relevant settings from your .cscfg file
also add eventhandler to the environment changing (RoleEnvironment.Changing += RoleEnvironmentChanging;) with e.Cancel = true so that the webrole restarts when ever you change .cscfg # the management portal
One walkarround is to rename your .cspkg file to .zip file. Then unzip the file and take a look to the files. You will find .cssx files (the larger files) representing each webrole / working role. rename to .zip and expand. Then you will find a "approot" folder. Your dlls, webconfig, etc are there. You can mess with the webconfig and zip+rename the way back.
It's not elegant at all, but sometimes is the best way to figure out what exactly are you publishing.

Does Windows service needs to be rebuild after changing config file?

I changed config file of the windows many times. Before changing config file I stopped the service and after changing config file, started again. Every thing worked fine.
But last time when I made some changes in config file of the windows service and started it - It didnt worked, I even tried reinstalling the service but in vain.
As a last resort I rebuild the service with new config file and copied newly build files on the server and installed the service. To my surprise the Windows service worked perfectly this time.But I have only made changes to config file and the code of the windows service was untouched. My question is, do we need to rebuild the Window service if we change the config file many time?
If you're referring to the automatically generated .config file, then no, the service need not be rebuilt. My guess is that in your last iteration you forgot an end tag or something, which caused the service to fail to load it's configuration.