HTTP Error 404.13 – Not Found Error When Upload Big File using WCF

On IIS 7.5, if you upload big file thru WCF service, you might get http 404.13 error from IIS server.

HTTP Error 404.13 – Not Found
The request filtering module is configured to deny a request that exceeds the request content length.

The solution is set a higher value for maxAllowedContentLength in web.config of application

<configuration>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="300000000"/>
</requestFiltering>
</security>
</system.webServer>
</configuration>

IIS 7.5 Error The temp directory in chart handler configuration is not accessible

If you build a web application with Chart control for ASP.NET 4.0 and deploy the site to web server.  You might get following error on the live site:

The temp directory in chart handler configuration is not accessible

To resolve this, first go to web.config and find the ChartImage directory in appsettings.

<appSettings>
<add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" />
</appSettings>

The go to the temp chart image directory and grant read and write permission to IIS working process account in share properties – security tab. Note that the account runs IIS working process is different between IIS 7 and IIS 7.5

  • On Windows Server 2008 has IIS7, grant Read and Write permission to Network Service
  • On Windows server 2008 R2 has IIS 7.5, grant Read and Write permission to AppPool\<PoolName>. Replace <PoolName> to the actual machine pool your site is running on, for example, if your site is running on pool named ASP.NET v4.0, then the account you need grant permission would be IIS AppPool\ASP.NET v4.0, you can refer this step by step instructions for detail

Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list

You might see following error when browse your application site made of ASP.NET 4.0 on IIS 7. This is because IIS is installed after DotNet and asp.net is not registered with IIS.

HTTP Error 500.21 – Internal Server Error
Handler &quot;PageHandlerFactory-Integrated&quot; has a bad module &quot;ManagedPipelineHandler&quot; in its module list

Resolution

To resolve this issue, run the following from command line:

aspnet_regiis.exe –i

This will register asp.net with IIS. The aspnet_regiis.exe file can be found in either

  • %windir%\Microsoft.NET\Framework\v4.0.30319
  • %windir%\Microsoft.NET\Framework64\v4.0.30319 (on a 64-bit machine)

Run IIS in 32-bit mode on a 64 bit machine

To configure ASP.NET to run in 32 bit mode on a 64 bit server.

On IIS6, open a command prompt and type following command and press ENTER.

cscript //nologo %SYSTEMDRIVE%\InetPub\AdminScripts\adsutil.vbs set w3svc/AppPools/Enable32bitAppOnWin64 1

On IIS7/7.5, open a command prompt and type following command and press ENTER.

apppool /apppool.name:MyAppPool32bit /enable32BitAppOnWin64:true

You can set the same in IIS 7 Manager UI by opening the ‘Advanced Settings’ for the app pool and change Change the Enable 32-bit Applications to True

Enable 32 bit applications in IIS 7

Grant Permission to DefaultAppPool Identity

After upgrading web applications to IIS 7.5 on Windows Server 2008 R2, you might get following error.

Access to the path ‘d:\site\cache.txt’ is denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.UnauthorizedAccessException: Access to the path ‘d:\site\cache.txt’ is denied.
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

Continue reading

Make IIS 7.5 application pools run as NETWORK SERVICE

There is a break change in IIS 7.5 on Windows 7 and Windows Server 2008 R2. The default identity for running an application pool is "ApplicationPoolIdentity".  If you have a web application developed against application pools running with NETWORK SERVICE on IIS6/7, it might break after migrated to IIS 7.5 due to default application pool identity change.

Continue reading