Pages

Search This Blog

Showing posts with label IIS. Show all posts
Showing posts with label IIS. Show all posts

Friday, January 4, 2013

Reset IIS on all the servers in FARM



Save the commands in a power shell script file and execute it in any of the servers present in FARM.



Write-Host -foregroundcolor Green "Restarting IIS on all the servers in FARM..."

[void][reflection.assembly]::LoadWithPartialName("Microsoft.SharePoint")
[void][reflection.assembly]::LoadWithPartialName("Microsoft.SharePoint.Administration")
[void][reflection.assembly]::LoadWithPartialName("System")
[void][reflection.assembly]::LoadWithPartialName("System.Collections")
# Get the local farm instance

[Microsoft.SharePoint.Administration.SPFarm]$farm = [Microsoft.SharePoint.Administration.SPFarm]::get_Local()

#Step through each server in the array and perform an IISRESET
#Also show IIS service status after the reset has completed

foreach ($server in $farm.Servers)
{
    if($server.Role -ne "Invalid")
    {
       Write-Host -foregroundcolor White ""
       Write-Host -foregroundcolor Yellow "Restarting IIS on server $server..."
       IISRESET $server.Name /noforce
       Write-Host -foregroundcolor Yellow "IIS status for server $server"
       IISRESET $server.Name /status
    }
}
Write-Host Write-Host -foregroundcolor Green IIS has been restarted on all servers
Read-Host 'Done...'



Monday, January 23, 2012

How to Create FTP site in IIS 7

You can follow below mentioned steps to create a Basic FTP site in IIS 7.

  • Create a folder named "ftproot" at <System Drive>\inetpub\" if it not already exists. You may use any name for this folder.


  • Set the permissions to allow anonymous access by typing the following command in the Command Prompt:
         ICACLS "%SystemDrive%\inetpub\ftproot" /Grant IUSR:R /T



  • Type "inetmgr "to open the IIS in command prompt.
  • Under Sites Section, right-click the node click Add FTP Site.

     

  • Enter name of the site and select the path of the physical folder that you created in step 1. Click Next


  • On the next section, Choose an IP address for your FTP site from the IP Address drop-down, or choose to accept the default selection of "All Unassigned."
  • Enter the TCP/IP port for the FTP site in the Port box. I will go with the default port of 21.
  • Make sure that the Certificates drop-down is set to "Not Selected" and that the Allow SSL option is selected. Click Next


  • On the next tab, select Anonymous for the Authentication settings.
  • I have selected the option - Allow Access to: All Users and given all the users Read and Write permissions. You can change these settings as per your requirements.


This completes your initial configuration.You can check the newely created FTP location by typing the following URL in Windows Explorer:
        ftp://%3cyour/ Domain>:port/
In order to add folders and files to the FTP location, you will need to enable Basic Authentication on this FTP site.
Now you are ready to access the FTP site in your domain.

Saturday, January 21, 2012

Switch Application on Claim Authentication

If your application is currently configured with window authentication, and want to switch on claim, you can use below powershell commends for it.

$SPWebApp = Get-SPWebApplication "http://localhost"
$ SPWebApp.UseClaimsAuthentication = $True
$ SPWebApp.Update()
$webapp.ProvisionGlobally()
iisreset

Thursday, December 22, 2011

Error occurs while deploying SharePoint solution through Visual Studio 2010 - Error occurred in deployment step 'Recycle IIS Application Pool': Cannot connect to the SharePoint site.

Last week, when I was deploying an existing SharePoint project from Visual Studio 2010, then I stuck in an issue. While deploying, Visual Studio 2010 throw an error

Error:

Error occurred in deployment step 'Recycle IIS Application Pool': Cannot connect to the SharePoint site. If you moved this project to a new computer or if the URL of the SharePoint site has changed since you created the project, update the Site URL property of the project.




Solution:


This is because we forgot to mention the Site URL where we are going to deploy our solution.

To set Site URL follow the following steps:

1. Select the Visual Studio project from the "Solution Explorer" toolbox and then open the property toolbox. Take care to open the property toolbox (visible in figure) and NOT the project property using a right click of the mouse.

2. Over there you will find a property called "Site URL", which must be changed with the new address of your new SharePoint 2010 web application.


After doing this, your deployment from Visual Studio 2010 will be smooth.

Friday, February 18, 2011

Restart Remote Machine IIS from Code

If anybody have requirement to restart Remote Machine IIS through code, then this is quite simple.

Scenario: If you are developing some assembly/dll, and need to deploy that dll in GAC. Each time you deploy that assembly in GAC, you must re-start IIS to see the changes.

Following code will make your life easy, because without going to server you can re-start IIS of that server.

Note:-To re-start remote machine IIS you must be an administrator of the remote computer. Either have your account added to the administrator local group of the remote computer or to the domain administrator global group.

using System.Diagnostics;
using System;

namespace ResetIISConsole
{
class Program
{
static void Main(string[] args)
{
string serverName = string.Empty;
try
{
//Read input from Console
//First argument as ServerName
serverName = args[0];
//IISReset Process resides in WINDOWS\SYSTEM32 Folder
Process iisreset = Process.Start("iisreset.exe", @"C:\windows\system32");
//Pass Name of the server
iisreset.StartInfo.Arguments = serverName;
iisreset.Start();
Console.WriteLine("SUCCESS: Done!!!");
}
catch (Exception ex)
{
Console.WriteLine("ERROR:" + ex.Message);
}
}
}
}


Another way to do this is simple command:

c:\Windows\System32>IISRESET [COMPUTERNAME]