Posts belonging to Category IIS



How To Change The Default .Net Version In IIS 7 IIS7.5

To change the default .NET Framework Version in IIS 7 and IIS 7.5 to .Net 4.0 follow these steps:

  1. Select the root element in the tree on the left – it contains the name of the server.
  2. Click on the "Change .NET Framework Version" link on the right panel. You will now see the "Change .NET Framework Version" dialog.
  3. Select the .NET 4.0 framework from the drop down list.
  4. Click [OK].

 

I hope that helps!

via Deploying .NET 4.0 applications using IIS 7.x

linkedin How To Change The Default .Net Version In IIS 7 IIS7.5digg How To Change The Default .Net Version In IIS 7 IIS7.5share save 120 16 How To Change The Default .Net Version In IIS 7 IIS7.5

Configure PowerShell Remoting for SharePoint 2010

The following is taken from Configure Remote PowerShell in SharePoint 2010

Setup your Remote Server
There are a few steps you have to take on your server to initialize and set it up running for remoting. once.
First, you need to run the following command on your server — Enable-PSRemoting

image thumb Configure PowerShell Remoting for SharePoint 2010

Next you need to let powershell know that your server machine or remote machine will act as the server.

Enable-WSmanCredSSP -Role Server

image thumb1 Configure PowerShell Remoting for SharePoint 2010

Setup your Client Computer
There are also a few one time setup steps you need to take on your client computer. You only have to do this once. The first thing to do, if you are going to use the logged in user’s credentials to make a remote session in powershell, is to enable client credentials delegation. This can be achieved by changing the group policy.
First, edit group policy on your client computer to all credential delegation. Using gpedit.msc, enable both of the following (Under Local Computer Policy–> Computer Configuration–> Administrative Templates–> System–> Credentials Delegation):

  • Allow Delegating Fresh Credentials
  • Allow Delegating Fresh Credentials with NTLM-only Server Authentication

image thumb2 Configure PowerShell Remoting for SharePoint 2010

Note: In case you are going to explicitly specify the credentials, you can skip the above step.

Second, run the following command
Enable-PSRemoting

image thumb3 Configure PowerShell Remoting for SharePoint 2010

Third, enable WSMan CredSSP with the following command:
Enable-WSManCredSSP -Role Client –DelegateComputer “NameOfServer”

image thumb4 Configure PowerShell Remoting for SharePoint 2010

Once you have configured remote powershell, now you are all set to run remote commands.

Create and enter a remote session of Windows PowerShell
If your current user on client machine has permission to the SharePoint farm and Windows PowerShell on the remote box, you can use Enter-PSSession to create and enter the remote session.
For example, connecting to machine SpServer…

Enter-PSSession -ComputerName SPServer
If it works, the command prompt will be changed to [SPServer]: PS C:\Users\Administrator\>.
The session will be closed when you type exit or Exit-PSSession.

To connect to a machine with CredSSP and a different credential, you can use
Enter-PSSession -ComputerName SPServer -Authentication CredSSP –Credential domain\username
This will open up a dialogue for you to type in password. Type in the password and press enter and your remote session will be created.

Store and use credentials for scripting

First, use the following command to covert password from keyboard input to a secure string in a text file.

Read-Host -AsSecureString | ConvertFrom-SecureString | out-file C:\crd-sharepoint.txt
As soon as you type the command, start typing the password.

image thumb5 Configure PowerShell Remoting for SharePoint 2010

When you need to create a credential object, read this password (the secure string) from the file and create the credential with the following command:

$pwd = Get-Content C:\crd-sharepoint.txt | ConvertTo-SecureString

then create the credential (replace #### with your domain\username):

$crd = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "####",$pwd

Then you will be able to use this credential in the command line without any dialogue.

$session = New-PSSession -computername "SPServer" -Authentication CredSSP -Credential $crd

Start Remoting on you Client Computer

Now your client computer is ready to actually create the session and import the SharePoint commands from the Server.

The next command adds the SharePoint PowerShell commands to your session.

Invoke-Command -Session $session -ScriptBlock{Add-PsSnapin Microsoft.SharePoint.PowerShell}

image thumb6 Configure PowerShell Remoting for SharePoint 2010

Note, that at this point, you can run whatever administrative PowerShell commands you need to run by using the Invoke-Command -Session $session -ScriptBlock{} syntax.

Importing remote commands into local session

Let’s see how one can import a remote command into a local session. First – let’s ask Import-PSSession cmdlet to look in the remote session $s, take all the remote commands matching "*-SPFarm" wildcard, add a "Remote" prefix to their noun, and then present them to me as if they were local commands:

Import-PSSession -Session $session -CommandName *-SPFarm -Prefix Remote

image thumb7 Configure PowerShell Remoting for SharePoint 2010

So, now we can run Get-RemoteSPFarm

image thumb8 Configure PowerShell Remoting for SharePoint 2010

 

Thanks again Configure Remote PowerShell in SharePoint 2010

linkedin Configure PowerShell Remoting for SharePoint 2010digg Configure PowerShell Remoting for SharePoint 2010share save 120 16 Configure PowerShell Remoting for SharePoint 2010

AutoSPInstaller for SharePoint 2010

The SharePoint 2010 Auto Installer (AutoSPInstaller) has released a new version 2.5.

Automated SharePoint 2010 Powershell-based installation script.

AutoSPInstaller works with and now leverages enhancements in SharePoint 2010 Service Pack 1 (with or without the June 2011 CU)! It takes advantage of some of the cmdlet updates in SP1, while remaining backward-compatible with non-SP1 deployments.

Versions 2.5.x and up include several updates to the input file XML schema from version 2.0 so make sure you compare any of your existing XML files to the new AutoSPInstallerInput.XML. See below for highlights of changes in v 2.5.x.

linkedin AutoSPInstaller for SharePoint 2010digg AutoSPInstaller for SharePoint 2010share save 120 16 AutoSPInstaller for SharePoint 2010

Enable SSL On SharePoint 2010

I went through the process of enabling SSL on our SharePoint 2010 website.  However, whenever I tried to use it I would be presented with a login screen.  I was using the farm admin UserID so I knew it had authority.

I was able to find the following Microsoft document: You receive error 401.1 when you browse a Web site that uses Integrated Authentication and is hosted on IIS 5.1 or a later version
I already had the DisableLoopbackCheck registry entry, so I tried Method 1 and it worked great:

Method 1: Specify host names (Preferred method if NTLM authentication is desired)

To specify the host names that are mapped to the loopback address and can connect to Web sites on your computer, follow these steps:

  1. Set the DisableStrictNameCheckingregistry entry to 1. For more information about how to do this, click the following article number to view the article in the Microsoft Knowledge Base:
    281308  Connecting to SMB share on a Windows 2000-based computer or a Windows Server 2003-based computer may not work with an alias name
  2. Click Start, click Run, type regedit, and then click OK.
  3. In Registry Editor, locate and then click the following registry key:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0
  4. Right-click MSV1_0, point to New, and then click Multi-String Value.
  5. Type BackConnectionHostNames, and then press ENTER.
  6. Right-click BackConnectionHostNames, and then click Modify.
  7. In the Value data box, type the host name or the host names for the sites that are on the local computer, and then click OK.
  8. Quit Registry Editor, and then restart the IISAdmin service.
linkedin Enable SSL On SharePoint 2010digg Enable SSL On SharePoint 2010share save 120 16 Enable SSL On SharePoint 2010

Could not load file or assembly ‘ChilkatDotNet2′ or one of its dependencies. An attempt was made to load a program with an incorrect format.

Thanks to Alex James Brown for the resolution explained below:

While setting up an application to run on a Windows Server 2008 R2 with IIS 7.5 I received the following error:

Could not load file or assembly ‘ChilkatDotNet2′ or one of its dependencies. An attempt was made to load a program with an incorrect format.

The ChilKat components used by the application was the 32bit version.

In order to resolve this error, you must set your app pool to allow 32bit applications:

 

  1. Open IIS Manager
  2. Right-Click on the app pool
  3. Select Advanced Settings (See below)
    setIISAppPoolAdvancedSettings thumb Could not load file or assembly ‘ChilkatDotNet2′ or one of its dependencies. An attempt was made to load a program with an incorrect format.
  4. Set “Enable 32-bit Applications” to True.
    enable32BitApplications Could not load file or assembly ‘ChilkatDotNet2′ or one of its dependencies. An attempt was made to load a program with an incorrect format.

 

linkedin Could not load file or assembly ‘ChilkatDotNet2′ or one of its dependencies. An attempt was made to load a program with an incorrect format.digg Could not load file or assembly ‘ChilkatDotNet2′ or one of its dependencies. An attempt was made to load a program with an incorrect format.share save 120 16 Could not load file or assembly ‘ChilkatDotNet2′ or one of its dependencies. An attempt was made to load a program with an incorrect format.

Force SSL On IIS 7

The following is a great article on how to force a browser to use SSL on a site hosted by IIS 7.  It is from SSLShopper.com:

Redirecting all traffic from HTTP to HTTPS in IIS7 will make sure your users always access the site securely. There are many different ways to set up an IIS7 Redirect from HTTP to HTTPS and some are better than others. The ideal HTTP to HTTPS redirect would do the following:

  • Gently redirect users to HTTPS so users don’t have to type in “https” in the URL
  • Redirect users to the specific page that they were going to go to on HTTP (page.htm)
  • Save any variables passed in the query string (?page=2)
  • Work in all browsers
  • Transfer PageRank to the redirected page by using a 301 redirect, maintaining SEO
  • Allow specific parts of a site to force SSL but allow HTTP on other parts of the site
  • Redirect users from mydomain.com to www.mydomain.com

Unfortunately, there isn’t an easy way to satisfy all of these requirements, and most methods only satisfy a few of them. The best method of doing an HTTP to HTTPS redirect I’ve seen involves using ASP.Net to do the HTTP to HTTPS redirection.

But most people don’t need all of those features, so I have listed two of the best methods of redirecting HTTP to HTTPS in IIS 7. They are easy to set up and effective in most situations.

Method 1 – Using Microsoft URL Rewrite Module

For this method of redirecting from HTTP to HTTPS, you will need to do the following;

  1. Install the Microsoft URL Rewrite Module
  2. Install your SSL certificate in IIS 7 and bind it to your website
  3. Make sure Require SSL is NOT checked under SSL Settings for your website (uncheck the boxes that are checked in this screenshot)
    iis7 redirect http to https2 Force SSL On IIS 7
  4. Copy and paste the following code between the <rules> and </rules> tags in your web.config file in your website root directory.<rule name="HTTP to HTTPS redirect" stopProcessing="true">
    <match url="(.*)" />
    <conditions>
    <add input="{HTTPS}" pattern="off" ignoreCase="true" />
    </conditions>
    <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
    </rule>
  5. Test the site by going to http://www.yoursite.com and making sure it redirects

Method 2 – Setting up a Custom Error Page

The second method of setting up an IIS7 redirect HTTP to HTTPS is to Require SSL on the site or part of the site and set up a custom 403.4 error page. To do this, just following these steps:

  1. Install your SSL certificate in IIS 7 and bind it to your website
  2. In IIS, click on the site name, and go to the SSL Settings section
    iis7 redirect http to https1 Force SSL On IIS 7
  3. Check Require SSL and Require 128-bit SSL and click Apply
    iis7 redirect http to https2 Force SSL On IIS 7
  4. After doing this, users will normally receive this error:
    iis7 redirect http to https3 error Force SSL On IIS 7
  5. Create a new text file and paste the following into it:

    <html>
    <head><title>Redirecting...</title></head>
    <script language="JavaScript">
    function redirectHttpToHttps()
    {
    var httpURL= window.location.hostname + window.location.pathname + window.location.search;
    var httpsURL= "https://" + httpURL;
    window.location = httpsURL;
    }
    redirectHttpToHttps();
    </script>
    <body>
    </body>
    </html>

  6. Save the file as redirectToHttps.htm in your C:\Inetpub directory
  7. Back in IIS, click on the site name and double-click the Error Pages option
    iis7 redirect http to https3.5 Force SSL On IIS 7
  8. Click Add… and enter 403.4 as the Status code. Browse for the redirectToHttps.htm file you just created and click OK
    iis7 redirect http to https4 custom error Force SSL On IIS 7


  9. Select the error code and press Edit Feature Settings…
    iis7 redirect http to https5 Force SSL On IIS 7
  10. Click the Custom error pages option and again browse for the redirectToHttps.htm file
    iis7 redirect http to https6 Force SSL On IIS 7
  11. Test the site by going to http://www.yoursite.com and making sure it redirects

A caveat of using a custom error page to do an IIS7 redirect from HTTP to HTTPS is that the web browser must have JavaScript enabled for the redirection to work.

linkedin Force SSL On IIS 7digg Force SSL On IIS 7share save 120 16 Force SSL On IIS 7

Remove All Files That Are Older Than

The following bat file will delete all files in a directory and its subdirectories that are have a modified date older than 2 years:

@ECHO OFF
REM *** DELETE FILES OLDER THAN 2 YEARS  

REM *** GET TODAYS DATE
@For /F "tokens=2,3,4 delims=/ " %%A in ('Date /t') do @(
  	Set Month=%%A
 	Set Day=%%B
 	Set Year=%%C
)  

REM @echo DAY = %Day%
REM @echo Month = %Month%
REM @echo Year = %Year%  

REM *** SUBTRACT 2 FROM THE CURRENT YEAR
set /a Year2=%Year%-2  

forfiles /p "E:\IIS6LOGFILES" /s /m *.log /d -%Month%/%Day%/%Year2% /c "cmd /c del @path"
linkedin Remove All Files That Are Older Thandigg Remove All Files That Are Older Thanshare save 120 16 Remove All Files That Are Older Than

How To Resolve The GDI + Is Not Properly Initialized (GDI + Error) Error

If you get an error like the one in the image below, recycle your website’s application pool.

GDI+ Is Not Properly Initialized (GDI+ Error)

image thumb How To Resolve The GDI + Is Not Properly Initialized (GDI + Error) Error

linkedin How To Resolve The GDI + Is Not Properly Initialized (GDI + Error) Errordigg How To Resolve The GDI + Is Not Properly Initialized (GDI + Error) Errorshare save 120 16 How To Resolve The GDI + Is Not Properly Initialized (GDI + Error) Error

Host Header On SSL Sites

This is an update to our previous post (Enable Host Headers On An SSL/HTTPS Site). Which used the following command to enable host headers on SSL sites:

[code lang="dos"]cscript.exe adsutil.vbs set /w3svc//SecureBindings ":443:"[/code]

I ran into some issues with using SecureBindings with the Sharepoint Central Administration sites so I thought I would post some of the other commands that I used:

To find out what bindings are on a site use the following command:

[code lang="dos"]cscript.exe adsutil.vbs get w3svc//securebindings[/code]

To remove the host header from an SSL site use the following command:

[code lang="dos"]cscript.exe adsutil.vbs set /w3svc//SecureBindings ":443:"[/code]

linkedin Host Header On SSL Sitesdigg Host Header On SSL Sitesshare save 120 16 Host Header On SSL Sites

Delete An Extended Web Application

Extended web applications are not listed in the web application list and cannot be deleted using the Delete Web Application link in Central Administration.

Use the following steps to delete extended web applications:

  1. Start Central Administration
  2. Go to Application Management
  3. Click Remove SharePoint from IIS Web Site to get a page with a form similar to the following.
    image thumb Delete An Extended Web Application
  4. Select the web application that the extended web app was extended from
  5. Select which extention/zone to delete
  6. Select whether to keep or delete the IIS Web site
  7. Finally click OK
linkedin Delete An Extended Web Applicationdigg Delete An Extended Web Applicationshare save 120 16 Delete An Extended Web Application