Category Archives: IIS

ASP.Net IIS

Install ASP.NET 4.5 in Windows 8 and Windows Server 2012

The Aspnet_regiis.exe utility is no longer used for installing and uninstalling ASP.NET 4.5 in Windows 8. ASP.NET 4.5 is now a Windows component and can be installed and uninstalled just like any other Windows component.

To install or uninstall ASP.NET 4.5 in Windows 8 or Windows Server 2012, use one of the following options:

  • Run the following command from an administrative command prompt: Console
dism /online /enable-feature /featurename:IIS-ASPNET45

For Windows 8 client computers, turn on IIS-ASPNET45 in Turn Windows Features On/Off under Internet Information Services > World Wide Web Services > Application Development Features > ASP.NET 4.5.

For Windows Server 2012 computers, enable IIS-ASPNET45 using Server Manager, under Web Server (IIS) > Web Server > Application Development > ASP.NET 4.5.

https://learn.microsoft.com/en-us/troubleshoot/developer/webapps/aspnet/www-administration-management/install-aspnet-45-windows-8-server-2012
Code Snippets .NET IIS Microsoft

Register asp.net in IIS 10

run as admin

 
C:\Windows\Microsoft.NET\Framework64\v4.0.30319>dism /online /enable-feature /featurename:IIS-ASPNET45

might need to enable this extensions:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319/dism /online /enable-feature /featurename:IIS-ApplicationDevelopment
C:\Windows\Microsoft.NET\Framework64\v4.0.30319/dism /online /enable-feature /featurename:IIS-ISAPIFilter
C:\Windows\Microsoft.NET\Framework64\v4.0.30319/dism /online /enable-feature /featurename:IIS-ISAPIExtensions
C:\Windows\Microsoft.NET\Framework64\v4.0.30319/dism /online /enable-feature /featurename:IIS-NetFxExtensibility45

C:\Windows\Microsoft.NET\Framework64\v4.0.30319/dism /online /enable-feature /featurename:IIS-ASPNET45
Code Snippets IIS

IIS: Redirect to another domain

Redirect from any page of www.mysite1.com to a static root of another site www.mysite2.com

 

<rule name="site2.com" stopProcessing="true">
             <match url=".*" />
             <conditions>
                 <add input="{HTTP_HOST}" pattern="^(.*)?site1.com" />                 
             </conditions>
             <action type="Redirect" url="http://www.site2.com/{R:0}" />
</rule>
Code Snippets ASP.Net IIS

SSL Redirect URL, rewrite rule

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.webServer>
	<rewrite>
		<rules>
			<rule name="Redirect to http" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
				<match url="*" negate="false" />
				<conditions logicalGrouping="MatchAny">
					<add input="{HTTPS}" pattern="off" />
				</conditions>
				<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Found" />
			</rule>
		</rules>
	</rewrite>
  </system.webServer>
</configuration>

read more »

.NET ASP.Net 2.0 IIS

The page was not displayed because the request entity is too large. iis7

“The page was not displayed because the request entity is too large.”

 

I think this will fix the issue IF you have SSL enabled:

Setting uploadReadAheadSize in applicationHost.config file on IIS7.5 would resolve your issue in both cases. You can modify this value directly in applicationhost.config.

1) Select the site under Default Web Site

2) Select Configuration Editor

3) Within Section Dropdown, select “system.webServer/serverRuntime”

4) Enter a higher value for “uploadReadAheadSize” such as 1048576 bytes. Default is 49152 bytes.

During client renegotiation process, the request entity body must be preloaded using SSL preload. SSL preload will use the value of the UploadReadAheadSize metabase property, which is used for ISAPI extensions

Reference: http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/7e0d74d3-ca01-4d36-8ac7-6b2ca03fd383.mspx?mfr=true

 

Code Snippets IIS wordpress

WordPress ISS Permalinks

Enabling Pretty Permalinks in WordPress

This walkthrough describes how to enable “Pretty Permalinks” for blog posts in the WordPress blog engine that is installed on IIS 7 and above. Typically, without URL rewriting functionality on a Web server, WordPress users must use “Almost Pretty” URLs, for example, http://contoso.com/index.php/yyyy/mm/dd/post-name/. By using the URL Rewrite module, you can use “Pretty Permalinks,” for example, http://example.com/year/month/day/post-name/, for WordPress blogs that are hosted on IIS.
Prerequisites

This walkthrough requires the following prerequisites:

IIS 7 or above with FastCGI and PHP installed. If you need to install PHP, follow the instructions in this article.
WordPress installed. If you need to install WordPress, follow the instructions in this article or use the instructions from the official WordPress site.
URL Rewrite installed.

Note that for the purposes of this walkthrough it is assumed that WordPress is installed in a Web site root directory. If WordPress is installed in a subdirectory, then the rewrite rules that are used in this walkthrough should be included in the Web.config file that is located within the same subdirectory where the WordPress files are.
Enabling Pretty Permalinks in WordPress

Use the following instructions to create pretty permalinks for your blog posts.

To enable pretty permalinks in Word Press:

Log on to WordPress with Administrator user rights.
In WordPress, click the Options tab.
On the Options page, click the Permalinks subtab.
This will take you to the page where you can customize how WordPress generates permalinks for blog posts.
On the Permalinks page, select Custom, specify below and enter “/%year%/%monthnum%/%day%/%postname%/” in the Custom structure text box.
Click Update Permalink Structure.

All the blog post links will have URLs that follow the format that you have specified, but if you click any one of those links the Web server will return a 404 – File Not Found error. This is because WordPress relies on a URL rewriting capability within the server to rewrite requests that have “pretty permalinks” to an Index.php file. In the next section, you will create a rule that will provide this capability.
Creating a Rewrite Rule

Open the Web.config file that is located in the same directory where the WordPress files are installed, and paste the following XML section into the system.webServer element:

<rewrite>
<rules>
<rule name="Main Rule" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>

This rule will try to match any requested URL. If the URL does not correspond to a file or a folder on the file system, it will rewrite the URL to the Index.php file. At that point, WordPress will determine which content to serve based on the REQUEST_URI server variable that contains the original URL before it was modified by this rule.
Testing the Rewrite Rule

After you save the rewrite rule to the Web.config file, open a Web browser and click any one of the permalinks in your WordPress blog. You should see the correct content returned by the Web server for each permalink.

Summary

In this walkthrough you learned how to use the URL Rewrite module to enable “pretty permalinks” in the WordPress blog engine. WordPress is just one example of the many popular PHP applications that can take advantage of the URL Rewrite module in IIS, a feature that enables user-friendly and search engine-friendly URLs.

 

 

By Ruslan Yakushev

http://www.iis.net/learn/extensions/url-rewrite-module/enabling-pretty-permalinks-in-wordpress

IIS

Select all sites in IIS manager

You should be able to do:

cd %systemroot%\system32\inetsrv\

and then delete them

appcmd list site /xml | appcmd delete site /in
IIS

IIS6 and Office 2007 MIME types

Error message:

 

    HTTP Error 404 – File or directory not found.
Internet Information Services (IIS)

Since Office 2007 was released after Windows Server 2003 and IIS6, IIS6 knows nothing about the new MIME types. So you need to manually add them:

Open Computer Management. (Right-click My Computer… Manage…)
Right-click Internet Information Services (IIS) Management… Properties…
Click MIME Types…
Click New… and add the following:

Extension     MIME Type
.xlsx     application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
.xltx     application/vnd.openxmlformats-officedocument.spreadsheetml.template
.potx     application/vnd.openxmlformats-officedocument.presentationml.template
.ppsx     application/vnd.openxmlformats-officedocument.presentationml.slideshow
.pptx     application/vnd.openxmlformats-officedocument.presentationml.presentation
.sldx     application/vnd.openxmlformats-officedocument.presentationml.slide
.docx     application/vnd.openxmlformats-officedocument.wordprocessingml.document
.dotx     application/vnd.openxmlformats-officedocument.wordprocessingml.template
.xlam     application/vnd.ms-excel.addin.macroEnabled.12
.xlsb     application/vnd.ms-excel.sheet.binary.macroEnabled.12

IIS Microsoft

IIS 8.0 error 401.2

Goto  IIS Console > web site properties >IIS authentication and Activate “Basic Authentication”

IIS Outlook

OWA saves .docx and .xlsx file as .zip

The problem:

When any Office 2007 attachment (.docx, .xlsx, etc) is opened from OWA, the user is asked to save the document before they open it. When they do this, the default extension is .zip. If the user changes it to the correct extension before opening, the file opens correctly.

This happens because the Office 2007 MIME file types are not configured on the web server and the users browser does not know how to open the files. If IE is configured to open files based on the file header, it identifies the file as a zip, which is technically correct.

The administrator can fix it site wide by adding the Office 2007 file types to the MIME settings on the server.

On the user side, IE has an option to open files based on content, not extension. The user should add the OWA URL to the Trusted (or Local Intranet) list before making this change.

read more »