Archive for category IIS

Could not load type ‘System.ServiceModel.Activation.HttpModule’ from assembly …

This error usually happens if .NET 4.0 is recently installed or followed by enabling .NET 3.0/3.5 WCF.

Follow these instructions to fix the problem:

  • Open Command Prompt and browse to the following path depending on the version of Operating System you have.

    • 32-bit: %windir%\Microsoft.NET\Framework\v4.0.30319
    • 64-bit: %windir%\Microsoft.NET\Framework64\v4.0.30319
    If you are using Windows 7 or Server 2008 then you must open the command prompt as Administrator.

  • Run aspnet_regiis.exe /iru

  • Test and make sure .NET 4.0 is enabled in the IIS configurations.

No Comments

SecurityException: Request for the permission of type ‘System.Web.AspNetHostingPermission

http://blogs.msdn.com/b/narahari/archive/2010/06/03/system-security-securityexception-request-for-the-permission-of-type-system-web-aspnethostingpermission-system-version-2-0-0-0-culture-neutral-publickeytoken-b77a5c561934e089-failed.aspx

SecurityException: Request for the permission of type ‘System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’ failed.]

Platform: Windows Server 2008 R2

This is the most common error you would get when you host your content on a UNC share. http://support.microsoft.com/?id=320268 describes the problem, resolution. However in this specific case content is not hosted on UNC share.

Cause:

This issue would happen when you download a file from Internet or Network Location, etc. Windows now preserves the zone information for file(s). This identifies where the file came from and displays appropriate warning messages, indicating you to be careful.

Note: Also when you copy the zip file from network location /Internet and extract the same, all the files contained in the zip file also will get this attribute set.

Resolution:

You can resolve this issue by following any of the following methods.

Method#1 Go to the properties of precompiled dll’s, check to see if it has following security message (at the bottom of the window): “This file came from another computer and might be blocked to help protect this computer.” If present, click “Unblock”, “Apply” and “OK”.

If you have multiple dlls in your application, you would need to perform this step to all dlls one by one.

Method#2 Run the below caspol command to resolve the issue Drive:WINDOWSMicrosoft.NETFrameworkv2.0.50727caspol.exe -m -ag 1 -url “file:////c:mysitecontent*” FullTrust -exclusive on

Note: Please substitute “c:mysitecontent*” with actual path where ASP.net pre compiled dlls are located.

Alternatively, you can use below methods to get around the issue.

To avoid the “This file came from another computer and might be blocked to help protect this computer.” You can use one of the following methods depending on your scenario.

1) Move all the files to non NTFS partition i.e. FAT and move them back to NTFS partition. When you move the files to non NTFS partition, it will not maintain zone information.

2) Use the “Strems v 1.56” tool to remove streams

a. Download “Streams v1.56” from http://technet.microsoft.com/en-us/sysinternals/bb897440.aspx

b. Execute the following command from command line:

“streams -s -d directory”

3) If you have copied a zip file to your machine that has the above attribute, before you extract, just unblock the zip file( as mentioned in resolution section) and then proceed with extraction.

4) There is a Group Policy, that you can Enable to make sure zone information is not preserved.

a. Run gpedit.msc ( From Run Prompt or CMD prompt)

b. Navigate to Local Security Policy > User Configuration > Administrative Templates >Windows Components >Attachment Manager

c. Enable “Do not preserve zone information in file attachments” setting.

This will only make sure that zone information is not present for the files that you copy after the policy is enabled. For Existing files, you would still need to use one of the above methods. Also, please consult with your Administrator, Team before you enable this setting, as this might be needed for other applications and might break those, if you enable it without taking consent from Administrator(s)/your team.

No Comments

AspNetHostingPermission Security Exception

I had this issue with Windows Server 2008 R2 with IIS 7 on a .NET 2.0 Integrated Application Pool and it drove me insane for hours. I finally found the solution at the following link:

System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

http://dbvt.com/blog/post/AspNetHostingPermission-Security-Exception-Fix-with-Ajax-in-IIS7.aspx

Solution is to go to the Advanced Settings for the Application Pool and make sure the “Load User Profile” is set to True.

No Comments

PHP on IIS7

http://www.php.net/manual/en/install.windows.iis7.php

No Comments

IIS: Creating SSL website

Here are some useful links I found related to the subject:

IIS 6.0 – creating Self Signed certificate
http://www.visualwin.com/SelfSSL/

IIS 6.0 – Creating SSL website using trusted certificate
http://www.petri.co.il/configure_ssl_on_your_website_with_iis.htm

IIS 7.0 – creating self signed certificate
http://technet.microsoft.com/en-us/library/cc753127%28WS.10%29.aspx

IIS 7.0 – Creating SSL website using trusted certificate
http://blogs.msdn.com/hongmeig/archive/2007/01/23/how-to-setup-ssl-on-vista-with-iis-7.aspx

No Comments

IIS 6.0 on Windows 2003 64-bit – XML page cannot be displayed

Problem:

The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
A name was started with an invalid character. Error processing resource ‘http://localhost/Publishtest/Home.aspx’. Line 1, ...
< %@ Reference Page="~/Search.aspx" %>
-^

Facts
Windows 2003 R2 64-bit with SP2

Solution
try to run the following to give you an indication of the problem or fix it for you.
%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i

or see

How to repair IIS mapping after you remove and reinstall IIS
http://support.microsoft.com/default.aspx?kbid=306005&product=aspnet

No Comments

IIS – ASP – setting time out

If you are using ASP.NET 2.0, use have to check in the IIS.
Open the IIS, click on the Application Pools, Select the Application pool for your application.
Right Click on that, Select Properties.
In the Performance tab, Set the idle timeout as your desired minutes for “shutdown worker processes after being idle for ….. minutes”.
Apart from this you have to set the timeout in web.config as well.

No Comments

IIS 7.0 – configure CGI

http://www.wrensoft.com/zoom/support/faq_cgi_iis.html

IIS 7.0 (Windows Vista, Windows Server 2008)

First, you must have the CGI role service enabled in IIS 7.0.
On Windows Server 2008, you do this by going to “Server Manager” -> “Roles” -> “Add Role Services”.

On Windows Vista, you can access a similar list of features from “Control Panel”->”Programs and Features”->”Turn Windows features on or off”->”Internet Information Services->”World Wide Web Services”->”Application Development Features”.

Once you have CGI role enabled, you can start up the “Internet Information Services (IIS) Manager”.

From here, you will first need to locate the folder that will be hosting your CGI and search files. This should be found under “” -> “Sites” ->” Default Web Site” -> ““. Right click on the folder and select “Convert to Application”. Click “OK” and accept the default settings.

Now select the “Handler Mappings” icon for this folder on the right hand side of the Manager window. You will see a list like below. Click on the “Add Module Mapping” option on the right hand side and enter the following:

Request path: *.cgi
Module: CgiModule
Leave the “Executable” field blank
Name: CGI

Click “OK” to finish adding the module mapping.

Now, the last step is to allow the CGI extension to run on the server. You do this on the “ISAPI and CGI Restrictions” page (I know, it doesn’t make sense to us either). This can be found by clicking on the machine name in the tree view to the left-hand side of the window.

On the “ISAPI and CGI Restrictions” page , click on “Add…” on the right hand side of the window. Now specify the full path to the “search.cgi” file hosted in the folder we have configured before. Make sure to check the option to “Allow extension path to execute”.

No Comments