Application Azure will be Aborted when upload publish file with Startup task - azure

I have created web application and one agent (EXE) with it fetch performance counter using WMI Query (compatible with 32 bit) so i have created one Enable32BitAppPool1.cmd file and add it in startup task, content of that file as per below
%windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.enable32BitAppOnWin64:true
and set property of that file "Copy Always" as per following this link.
Now when i am going to upload that package to Azure then it will be Aborted or in Buzy mode
Can anyone please tell me the reason of this?

It seems your cmd file not working in startup task.
Two possible solution
1> Create .bat file and try in as a start up task for your webrole.
2> other solution is that, try to run the file (.cmd) using system.Diagostic.process.start(...) from some other exe file and set that exe file as a startup task.

There is absolutely no way to know, based on what you've posted, what's going on.
I'd enable remote desktop on that instance and check out the event logs to try and get a handle on what's happening.
If you can't remote desktop in because your startup task is killing it - then disable the startup task, remote desktop in, and try to run what you think the startup task is doing - but manually - so you can see what's actually going on.

Related

When is a Azure Cloud Startup Task Executed?

I have setup a startup task on my Azure Cloud Service for Web Role.
It executes a startup.cmd file which installs a third party S/W on cloud.
I have tested it on my local machine and it worked fine.
Now I have some questions about its execution on Azure Cloud Server:
Will startup task execute as soon as I publish my application on
server? Or I have to do something manually to get it executed.
How can I get information about execution of startup task? like it's
success, failure or is it executed or not? error messages and all.
Thank You
Answers to your questions from this link:
Will startup task execute as soon as I publish my application on
server? Or I have to do something manually to get it executed.
Yes. You don't have to manually trigger these startup tasks. Please see Role Startup Order section in the link for more details.
How can I get information about execution of startup task? like it's
success, failure or is it executed or not? error messages and all.
You can log the errors encountered during the execution of startup tasks in a directory specified by the TEMP environment variable. From the same link:
Your startup task can log information and errors to the directory
specified by the TEMP environment variable. During the startup task,
the TEMP environment variable resolves to the
C:\Resources\temp[guid].[rolename]\RoleTemp directory when running on
the cloud.
Startup tasks must end with an errorlevel (or exit code) of zero for
the startup process to complete. If a startup task ends with a
non-zero errorlevel, the role will not start.

Notepad++ save adds weird characters

I'm trying to run a task on the Worker Role. I added a file named Startup.cmd with the following content:
icacls "PDFs" /grant Users:(OI)(CI)F
EXIT /B 0
All this does is give the Users group full control to the PDFs folder. The task does run because the Microsoft Azure Activity Log window shows the message Details: Starting role... Application startup tasks are running. [2015-02-04T23:39:28Z] when the Worker Role is deployed. I then log into the machine using Remote Desktop and the security on the folder is not as expected. I then try to run the command manually and I see this:
The file has some weird characters which is making the command fail: icacls.
Can Azure Publishing be causing this?
It looks like your script is being saved with a byte order marker. Try saving the script as ascii or as UTF-8 without a BOM. That might work out better for you.

How can I report an Azure startup failure to user

My company produces a tool that the user installs on the server prior to publishing their project. For Azure deployment we have a startup script (a simple .cmd file) that installs our tool. It has the recommended checks for repeat runs, and logs everything. The problem is that the user can't tell if there was an installation problem without RDPing to the role instance and checking the logs.
My question is: if there is a failure installing our tool is there any way to report it back to Visual Studio?
I don't believe there is. If I recall correctly, the startup tasks are fired off as part of the role's startup process (depending on the startup task type - simple, background, etc.). That script is running along with other things like the plug-in that configures Remote Desktop (which I believe the plug-in is a specially packaged type of startup script). I don't think there is anyway to report back (to whatever initiated the deployment operation) what startup tasks failed.

How to run Application.exe before windows startup?

I have a windows application with user Interface that do some stuff...
Now my client wants that, when he pushes the power button MyApplication run before he forced to input the username and password!
comment: the system is multi user on windows XP or Seven.
Is it possible anyway?
I found the way to do this was to create a scheduled task with a trigger for "on startup". This starts the application before windows logon. This is particularly useful in a server type environment if you need to have something run that is not a service.
It is simple. The process is.
Run gpedit.msc
Go to computer Configuration -> Windows Setting -> Scripts(Startup/shutdown)
Go to Startup properties then you will get the new windows.
Now add the program that you want to run before login.
The right way to do this is to implement a Windows service.
I've used this article here as I run a Minecraft server which I need to have the console interactive so I can manage the server and running it as a service is not a good solution in such a case: https://www.tenforums.com/tutorials/138685-turn-off-automatically-restart-apps-after-sign-windows-10-a.html
What I did was edit the registry:
Go to HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
Create a new DWORD value (if this DWORD doesn't exist already) and
call it RestartApps with the value of 1
This now starts apps that usually startup before you log in and starts the programs in shell:startup
You can not run an exe without first loading the operating system. You can, however, run the exe without logging in first. Just add copy and paste the shortcut for the exe into C:\Documents and Settings\Administrator[or other user name]\Start Menu\Programs\Startup. Then check msconfig to make sure your exe is checked to run on startup.

Script to check IIS running or not

I would like to write a script to start IIS server automatically if it is stopped.
You can use the IIS Admin Scripts to query the server, and then start it if you need.
The script is located in %systemroot%\system32.
To query you server, just run IIsWeb.vbs /query w3svc/1 from a command line.
If it's not running, then you can run IIsWeb.vbs /start w3svc/1 to start it.
Here is an article with more information on these scripts.
you can look for w3wp.exe in the process list (if it's IIS6)
you can always try "iisreset /start" - I believe, it works even if IIS is already started
take a look at the scripts provided by Microsoft in C:\Inetpub\AdminScripts (assuming default install location), there is startsrv.vbs, startweb.vbs - both do a good job
One simple thing you can do if you are worried about iis not restarting after it fails is to set the services responses. If you go into services and then look at the properties for iis, you will see a recovery tab. Change each of the failure options to restart the service. one thing you could also do is create a batch file that includes
iisreset
and set the option to run program and have that be the program you select.
Found some code here: https://social.msdn.microsoft.com/Forums/en-US/5a01d88b-2b7c-4d0b-bce0-9b90a236b64a/how-to-check-if-iis-is-running?forum=asmxandxml
Example:
Dim sc As New System.ServiceProcess.ServiceController("World Wide Web Publishing Service")
If sc.Status.Equals(System.ServiceProcess.ServiceControllerStatus.Stopped) Or sc.Status.Equals(System.ServiceProcess.ServiceControllerStatus.StopPending) Then
' Start the service if the current status is stopped.
sc.Start()
Else
' Stop the service if its status is not set to "Stopped".
sc.Stop()
End If

Resources