Archive for category Webservers

Request-URI Too Large

The circumstances that I came across the “Request-URI Too Large” Apache message is rather unique. In short, I’m loading graphs (images) on a dashboard from another website (Graphite) and the URL for the image can get pretty big because the image needs to be rendered by the Graphite render API.

Disclaimer: If you’re using forms and GET then I would definitely recommend changing the form to use POST and this solution should not be used.

The problem here is that Apache httpd has limited the amount of data that can be accepted through Request line. The default is 8192 bytes or 8 KB.
http://httpd.apache.org/docs/2.2/mod/core.html#limitrequestline

In order to overwrite this then simply add the following to virtual host or server config.

LimitRequestLine <sub>bytes</sub>

e.g. LimitRequestLine 15360

No Comments

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

Apache Warning – [warn] _default_ VirtualHost overlap on port 80, the first has precedence

Message on starting httpd:[warn] default VirtualHost overlap on port 80, the first has precedence

Solution:
The reason you’re getting this message is because you’re supporting more than one site on the same port which in this case it is port 80. To fix the issue simply open the httpd.conf file (usually found in /etc/httpd) and add uncomment or add the following line:

NameVirtualHost *:80

No Comments

Enabling .htaccess in Apache

To enable .htaccess for Apache you must:

  1. Find httpd.conf and open it to edit

  2. In the file find references to AllowOverride for your webroot directory or any other directory you have set up and wish to use .htaccess in and change NONE to All

  3. Close and save the file

  4. Restart Apache service for changes to take effect

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

Securing Web Applications

Pretty good explanation of how to secure your web applications. You have sign up for a free account but it’s worth it.

http://searchsecurity.techtarget.com/generic/0,295582,sid14_gci1163209,00.html?track=NL-427&ad=755356USCA&asrc=EM_NLT_11123741&uid=8951391

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