how can I use w3wp to start SharePoint applications from command line? - iis

Can anyone tell me how to use w3wp to start SharePoint applications from the command line?
And provide me with a small example.

You could try to run the command below in the command prompt to start the site that is hosted on the IIS.
%windir%\system32\inetsrv\appcmd start sites "Default Web Site"
If you want to start the App pool then you could use the command below.
%windir%\system32\inetsrv\appcmd start apppool "DefaultAppPool"
Output:
To stop the site you could use the command below.
%windir%\system32\inetsrv\appcmd stop sites "Default Web Site"
Notes:
make sure you run the command prompt as an administrator.

Related

How to debug startup Errors on Azure App Service

I am getting this error when my App Service starts on Azure:
An error occurred while starting the application.
I have not been able to find any relevant errors in the event logs.
How can I debug this?
I found this page very helpful:
In particular, there is a tool in Azure called Kudu Services (Under Development Tools/Advanced Tools) which lets you open a command prompt for your site, and then run dotnet your.dll
This will show you the exact error message that is occurring as if you were running it on your own localhost with all output.
Steps:
Open Kudo
Go to DEBUG CONSOLE (Top Menu), then CMD
This will open a black command window.
CD site
CD wwwroot
DIR to list contents. Find your dll in the list to ensure you are in the right location.
DOTNET your.dll
The site will then start up, or fail to start. If it fails, it will show the relevant messages so you can debug.

How can I allow user without administrator rights start stop application pool in IIS from cmd

When I'm running console in elevated mode following command works fine.
appcmd start apppool /apppool.name:MyApp
I need to start\stop app pool from CI, that runs on different user whithout administrator rights. How can I allow this user to start/stop application pool?
Solved with putting command to .bat file, and running it in elevated powershell from cmd.
Command for cmd
powershell -Command "Start-Process C:*****.bat -Verb RunAs"

Deluge Windows Service

I am trying to run the DelugeD.exe as a windows service. After installing Deluge and creating the services using NSSM, I try to start the service and get the following error:
Windows could not start the Deluged service on Local Computer. The service did not return an error. This could be and internal Windows error or and internal service error. If the problem persists, contact your system administrator.
I have created the Deluge-web-debug.exe as a Windows Service and it successfully starts. When I browse to http://localhost:8112 the web client appears, however the Connection Manager shows the Deluged daemon has not started.
No error, no logs, what could be the cause?
Thanks!
I thought I would start from scratch, reinstall deluge for windows, and try again. After this it still failed.
Using nssm, the error was:
deluged: Unexpected status SERVICE_PAUSED in response to START control.
This placed the service in a perpetual Paused state.
Finally, I decided to tear down the services using nssm remove, kill any running deluge processes, then delete the Config folder where deluged was pointing.
I am certain deleting the Config folder and all files was what solved the problem, and now it starts successfully.
I think I just solved this one by checking the "Allow service to interact with desktop" box under the LogOn tab for both the Deluge daemon and the WebUI services I created with nssm:
"Allow service to interact with desktop" in services.msc

PhantomJS Webserver exe on Azure Web Role Startup

I am trying to launch a local webserver instance of PhantomJs on a Azure Web (or Worker) Role to use with HighCharts for rendering server side charting images.
PhantomJs comes as just a simple .exe that can be launched as a webserver with the following command:
phantomjs highcharts-convert.js -host 127.0.0.1 -port 3003
... and then local HTTP POST requests can be made against it.
I have included this command in a startup.cmd batch script that is configured to execute with my Azure Web Role when published via ServiceDefinition.csdef:
<Startup>
<Task commandLine="startup.cmd" executionContext="elevated" taskType="background" />
</Startup>
startup.cmd:
START phantomjs highcharts-convert.js -host 127.0.0.1 -port 3003
EXIT /B 0
From what I can tell, this appears to execute fine on startup, however, the process does not stay running. It just executes and closes. For example, I can remote into the box, find the deployment and execute startup.cmd manually (in which a command window opens and stays open), and everything works fine.
How do I execute the PhantomJs exe webserver upon instance startup to where it continues running and does not close?
I have tried setting taskType to simple and background in the ServiceDefinition.csdef declaration, yet it doesn't seem to change anything.
It could be a timing issue if it is executing. You could add something like:
ping 1.1.1.1 -n 1 -w 300000 > nul
before you execute the script.
You could also pipe out to a log file so if its executing you can see what it is doing. >> log.txt.
If its not executing I would probably look at the path given its executing in the background and not interactively.
Turns out that I did not have the supporting .js files set to "Copy To Output Directory", so the startup.cmd could not find them.
Thanks to Steve for the output logging suggestion, which allowed me to see the error that it could not find "highcharts-convert.js".

How to run webapp on Azure with classic mode

I want to run the app with classic mode, but in Azure how should I do that?
The only idea I can figure is startup script? Is that correct?
You have to deploy your website in a WebRole, and not WebSite. Doing so, you have the ability to run a startup task in elevated mode.
Put the following line in your startup task script:
appcmd.exe set config -section:system.applicationHost/applicationPools /applicationPoolDefaults.managedPipelineMode:"Classic" /commit:apphost
And this will do the trick.

Resources