I have a C#/WPF app that uses ClickOnce for deployment. There is a scenario where the app needs to restart (the user changes a database). I do it by:
System.Diagnostics.Process.Start(System.Windows.Application.ResourceAssembly.Location);
System.Windows.Application.Current.Shutdown();
After restart, it seems that the app has issues:
The version becomes 1.0.0.0.
The current database setting is set to default (it is in the application's Properties.Settings).
I don't know that I fully understand the question, but I do know there is an issue with the method you are using to restart the application if it is a ClickOnce application. When you restart the application this way, ApplicationDeployment.IsNetworkDeployed will be false. See this post for a full explanation: http://bit.ly/RKoVBz.
I haven't verified the proper way to restart the application yet, but I'll update this a soon as I do.
Related
I'm running a Google App Engine production server, using basic_scaling as the scale type. Whenever I update the code and deploy it - using gcloud app deploy - the old version of the code is shutdown.
According to the documentation, that's expected:
The shutdown process might be triggered by a variety of planned and unplanned events, such as:
You manually stop an instance.
You deploy an updated version to the service.
...
I understand that it's easier for most developers that way. But in my case, I'd like to keep the old versions running until the idle_timeout limit is reached. Does anyone know if there's a way to avoid the automatic shutdown and let the old versions to shutdown by themselves?
Per Google's documentation, when you deploy your code, the default flag of --stop-previous-version is used. This forces the previous version to be stopped. If you do not want that, you should explicitly use the --no-stop-previous-version in your deploy command (we also have this as a feature on our App, a GUI for GAE; you check or uncheck a checkbox).
Unfortunately, Google does not provide a way for the service to automatically shut down later. You'll have to manually shut it down and start the other version later.
We are using Plesk to host our production services.
Basically when I deploy application to Plesk using Git, I need to press Restart application within Node page on Plesk GUI and that works well.
But in some cases I need to do that pragmatically, I need to automatically restart Node service. Does Plesk offer such functionality? Maybe, some kind of API that listens to calls or else within Linux shell itself.
When you click Restart App you'll notice a message state Information: The restart.txt file was touched. Application will be restarted after the first request.
You can emulate this action after the deploy by checking Enable additional deploy actions in the git repository options, and touching the same file here (I also run npm install too). Screenshot attached.
Since there was no answer for a while, this is my old workaround that I used for PM2 scripts force reset:
If it's a webserver application, e.g. Express.js, add protected route that can be accessed only within your privatae network (for security reasons) which basically kills main process via process.exit(0) and your webserver will get reseted automatically by PM2 or whichever service you use for it. However, I wouldn't recommend this method for anything above staging.
I have this issue too, and Plesk support don't have an answer for me either.
According to the Plesk blog here: "Moreover, if your app is running in the “development” mode, you don’t need to restart the app every time you modify the contents of a file."
I'm very new to Node so I don't fully understand the implications but I guess if you run the app in development mode, then you won't need to manually restart the Node Application.
The only way I have found that consistently works on Plesk is this command:
touch tmp/restart.txt
Even in development mode, Node does not seem to automatically restart.
What's worse is that it takes about 5-6 seconds before Node finishes restarting, using the touch method.
My takeaway is that a Plesk server is the wrong place to do Node development or testing.
Having a WPF app we've got a server that lets the user to install using ClickOnce distribution. The issue here is the link we provide changes to hide real filesystem.
First time the user tries to install the app, everything goes well; the .application gets launched remotely and the app gets installed.
Next time the user wants to update the app, if the link provided is differente (because of a token or a differente sub-path) the user will receive a DeploymentException saying that the same app is already installed from a different location.
Is there a way to allow the app to be installed from any location we provide?
Thanks!
UPDATE 1:
Let me explain what we've got so far:
We have a web server that publishes a folder where the app lives. The path depends on some factors so it may change. if the user wants to install the same app from a different url path, it will fail.
Something like:
http://site.site/app_15/App.application
http://site.site/app_16/App.application
being app_15 and app_16 the same app but installed on different dates and admin sites.
I have a WPF (Clickonce) app. I want to find out which users are installing or re-installing the app, and probably write those info in a database for audit.
How can I do that?
The current ClickOnce deployment doesn't provide any server-side hooks for monitoring whatsoever (in fact, the "website" generated by ClickOnce publishing is just a very simple, plain HTML page providing a link/button for downloading and executing the .application or setup.exe, respectively, on the client machine. Everything else is taking place locally).
Now, depending on what you want to log (initial installations, or updates, or both) you have the following options:
Create your own website where user will register before getting access to the install/launch for the app (or maybe you just identify them by IP - depends on your needs) - this allows you to log who first installs the app, but not the automatic updates.
In your application, use the classes in the System.Deployment namespace (notably ApplicationDeployment) to access information about updates etc. whenever your application is run. You can then have your app make calls to a web service that you provide, where you can log any installation / launch action (or even other runtime information, like usage of certain features, exceptions etc).
If you are targeting .NET 4, you can have the log files go to a specific folder. Then when the user runs the application, you can have it copy it to your server and delete it, or write it to a database and delete it. Here's an article explaining how to specify where to put the log from a ClickOnce deployment. Note that it runs when you install, update, or uninstall the application.
http://robindotnet.wordpress.com/2010/05/31/enhanced-logging-in-clickonce-deployment/
The registry settings are in HKCU, so you could have your C/O app actually set the info when it first installs. You'll miss the first install log, but it will write the logs to disk after that.
Also note that the article tells you how to turn on verbose logging. You don't have to do that just to write the log to a folder.
I have created an application that can save data both local drive and isolated storage. Then I have tested it by deploying via ClickOnce with FullTrust. This worked correctly, but when I set it to PartialTrust (Internet zone), the application cannot start up.
How to solve this problem?
I have tried to create empty form Windows application and then deploy using PartialTrust, it still errors when I run the application.
ClickOnce applications do not need full trust permissions to write to isolated storage. However, applications do need full trust for regular file I/O. So I'm guessing that your application will have to request full trust to work.
However, I'm not sure why your empty application won't work with partial trust. What error message do you get?
Are you using the SaveFileDialog? From memory, this throws a UIPermission exception for a partial-trust ClickOnce app deployed from the Internet zone. If that's what is happening, you need to change your app deployment to request this specific permission.
UPDATE: If you do a debug build, the exception stack trace will give the line number that caused the security exception.