How to remote restart an IIS7 Application pool - iis-7

How to remote restart an IIS7 Application pool
Please note that the source computer and target computer are running IIS7 in windows 2008 Server R2 so would have to be using Powershell.
Thanks!

From a remote machine you would need to run the following command to restart the IIS7 application pool:
Invoke-Command -ComputerName "webserver_computerName" -Credential $credentials_from_last_step -ScriptBlock { Add-PSSnapin WebAdministration; Restart-WebItem 'IIS:\AppPools\DefaultAppPool' }
Please use this link which can help you to control IIS7 remotely with PowerShell.
More info about Restart-WebItem is here:
Restart-WebItem => Restarts an application pool or a Web site.

You can also just change the web.config file (add a space or make a change). This will cause the application pool to be recycled as there may be changes in the app configuration file.

Related

Install ASP.NET application on IIS on Windows Server 2019

I try to install an ASP.NET application to IIS on Windows Server 2019.
The application is built against NET 4.7.1, and it works just fine on IIS in Windows Server 2012 and 2016.
However, when I try to install it on new server running Windows Server 2019, the problems starts from the configuration phase.
Specifically:
I copy the app with all the files in a folder on new server (2019)
I create the appPool, using ApplicationIdentity, enable 32 bit access
I create the web application, set to path the folder, set the appPool
to my newly created apppool
I set the permissions to read / write access for IIS AppPool\DefaultAppPool
But I cannot even do any further configuration in IIS Management.
When I try to edit any config option (default page, etc, etc) IIS manag gaves me error that it cannot access the web.config file
I even set temporarily access rights to web app's folder to full access for everyone (!!!) - no success.
Any idea what can be?
It's possible that was an error with creating the VPS image.
I recreated it and after that everything went ok

Restart windows service on server (Windows 2008 R2) having UAC turned ON (from ASP.NET application)

I am trying to restart a windows service (part of the application) from my ASP.NET (.Net 4) application but it fails with the error:
Cannot open <ServiceName> service on computer '.'.
Inner Exception: Access is denied
StackTrace: at System.ServiceProcess.ServiceController.GetServiceHandle(Int32 desiredAccess)
at System.ServiceProcess.ServiceController.Start(String[] args)
at NetClient.AvailabilityConfiguration.StartAvailabilityService(ServiceController serviceName, TimeSpan timeout)
The code is working fine on my development machine (Windoes 7) and test server (Windows 2008 R2) but fails on the production server. The only (and BIG) difference is that UAC is turned ON the production serevr where as it is OFF on the dev and test servers.
I have tried adding an app.manifest file to the web application to get elevated privileges but it does not seem to work. I've configured the app.manifest "requestedExecutionLevel" attribute to "requireAdministrator" but does not seem to have an effect.
Any help will be greatly appreciated.
Thanks
Aju
I think that is clear that the account that runs the pool of your web have not rights to manage the services (especial the Start, Stop, Pause commands).
See under what account your pool is running, and give him the permission to manage the services of your server. You can do that using the group policy, or open the security template.
Read the official detailed steps for How to grant users rights to manage services in Windows Server

MSDAORA provider not found for asp.net site

I've got stuck with strange Oracle connection error on Windows Server 2003 x64 (IIS 6)
While console .Net application that runs onbehalf of administrator successfully connects to Oracle 10g Express via OleDb [Connection string looks like: Provider=MSDAORA;Data Source=server-ip:port;User Id=user;Password=password;]
ASP.NET 4.0 web-site (application pool runs on behalf of administrator too) fails with error:
The 'MSDAORA' provider is not registered on the local machine
Connection string is the same, but it doesn't work for asp.net site. What shall I check?
Thank you in advance!
This Social.MSDN link seems to point to the fact that you have x86 drivers installed;
From my viewpoint you have two options:
Convert the app to run on 32bit mode in IIS - Can help if you require assistance. LINK
Download and try the 64bit version of the drivers. Oracle x64 downloads
Another approach would be to enable 32-bit applications for the IIS Application Pool your application is using. I would suggest creating a new application pool specifically for your application making sure to enable 32-bit applications.
You'll likely suffer performance issues but at least you'll be up and running.
I have resolved this issue in one of my applications with ASP(MSDAORA connection) - oracle environment with following fix from
http://technet.microsoft.com/en-us/library/cc784046.aspx
following are the steps
To enable IIS 6.0 to run 32-bit applications on 64-bit Windows
1.Open a command prompt and navigate to the %systemdrive%\Inetpub\AdminScripts directory.
2.Type the following command:
cscript.exe adsutil.vbs set W3SVC/AppPools/Enable32BitAppOnWin64 true
3.Press ENTER.

How to run Console Application from a ASP.NET Application?

How can I run a console application (.EXE) from ASP.NET Application.
Both ASP.NET Application & Console application are on the same server and in the same directory but in different folders.
ASP.NET Application is hosted in IIS Server
How can I run the console application from my asp.net web application ?
Sorry for asking the question in an improper way, now I have updated it as per my exact need.
My first guess is that it might be a firewall issue since the remote machine is refusing the connection. If the code is running on the same server as the executable you want to run, why are you entering an IP address? Try changing the IP to 127.0.0.1 or LOCALHOST and see if you get the same error.

How do I create websites on remote servers using appcmd?

I have used appcmd to create websites on my local computer. There doesn't appear to be a server parameter which means that i have to remote desktop on to each machine that i'm deploying to and run the appcmd command.
Also, can i use appcmd to deploy to IIS 6.0? If not, how do i deploy to remote IIS 6.0 web servers? I've tried the iisweb.vbs but i can't get it to run on my windows 7 computer because it can#t find the Microsoft.cmdlib. I have tired registering this file but it doesn't make a difference.
Using psexec.exe from sysinternals has worked for me to run appcmd on the IIS7 host from my administration host.
you can run a web service on the target machine, the web service should have the privileges
to add websites to the iis server (done by using System.DirectoryServices
After much searching of the internet i could not find an existing tool that needs to do what i need it to do. So in the end i had to create my own utility application that creates websites using WMI.

Resources