Sunday, May 15, 2011

Page cannot be displayed when you upload using Asp.Net application


You may receive ‘Page cannot be displayed’ error message when you upload a large file using Asp.Net application. This is because the default size supported by Asp.Net 2.0 is 4MB. When you try to upload a file size more than the default you will receive this error. 

To fix this we have two properties in httpRuntime, namely,

·         executionTimeout
·         maxRequestLength

By modifying it you can upload a file sized more than the default. Usually maxRequestLength is mentioned in KB. You can set the maximum value according to the need.
Below configuration is used to upload a 10MB file,

<system.web>
<httpRuntime executionTimeout="1000" maxRequestLength="10240"/>
</system.web>

Fine tune executionTimeout value in order with maxRequestLength.

Monday, March 7, 2011

How to register ASP.NET on IIS


  1. Open Command Prompt.
  2. Change directory as follows:
    • For 32-bit machines change to:
      <WindowsDir>\Microsoft.NET\Framework\<version number>\
    • For 64-bit machines change to:
      <WindowsDir\Microsoft.NET\Framework64\<version number>\
  3. Run the command ‘aspnet_regiis.exe -i’ and press enter.

Monday, February 28, 2011

Terminal service connection exceeded


Wondering what to do on this message!

It’s simple. You can use mstsc /console to login. But this is not a recommended solution.

This case occurs only when there are two users logged in the server. Accidentally if any of the users forget to logoff and left the server the account is disconnected but no one could login again.

You can use ‘Terminal service connection manager’ from another system to connect to the respective server and logoff the unattended session. 

Another way to logoff unattended login’s can is done from command prompt.

Here are the commands,

Qwinsta

Rwinsta

Qwinsta – This command is used to query who are all in server.

Eg. Qwinsta /server:servername

Rwinsta – Using this command you can reset the session.

Eg. Rwinsta /server:servername sessionID


HTTP Compression

 What is HTTP compression?
As the name states it compresses specified files types when they are requested by clients. This is done on the fly.
Advantages:
  1. Bandwidth consumed is less since mentioned file types are compressed and then sent to client.
  1. Faster data transmission.
Disadvantage:
  1. CPU usage is more.
How to enable HTTP compression in IIS?
  1. Open IIS
  2. Right click website for which compression needs to be enabled.
  3. Select ‘service’ tab.
  4. Check the option ‘Enable HTTP compression’.
How to enable and enable/disable for specified application?
This cannot be done through IIS. However this can be done using scripts. Following command used to enable/disable HTTP compression for specific application.
cscript.exe adsutil.vbs SET w3svc/1/root/APPLICATION NAME /DoDynamicCompression true
cscript.exe adsutil.vbs SET w3svc/1/root/APPLICATION NAME /DoDynamicCompression false