|
Resources » .NET programming » .NET Framework
Configuring the IIS and url-rewrite
This article contains the basic iis configurations
and URL rewrite informations the url rewrite is needed for the following reasons Url-rewriting enables you to forward requests to the new page location without breaking browsers and this happens when you want to ensure that people who have bookmarked old URLs don't break when you move pages around.
|
How to configure IIS for url rewrite
To configure your IIS for url rewrite, do the following steps:
a) Open the Inetmgr using the run b) Add application pool which will be available on the right side corner under actions tab c) Name your application pool example:test.yoursitename.com (Make sure you give a meaningful name to your site) d) Select the appropriate framework version basically it is of two types [v2.0.5027] and [v4.0.30319] e) select the pipeline mode as integrated There are two types of pipeline mode i) Integrated ii) Classic
Integrated mode Vs Classic mode in IIS Classic: When using classic mode the server uses two piplines to handle requests, one for native code and the other for managed code opting for this mode will limit the application to take the advantage of IIS 7 to the fullest
Integrated: i) Integrated mode handles all requests through a unified pipeline for IIS and is tightly integrated with ASP.NET through that same pipeline ii) ASP.NET sees every relevant request and manipulates things along the way rather than acting as an external plugin iii) With integrated mode ASP.NET runs much more efficiently in IIS and will yield greater performance for your site f) Check ON the Start application pool immediately
Editing the application pool and the recycling the settings: To avoid memory leaks in your application,configure your application pool to recycle, when the memory that is used by the W3wp.exe process reaches a configured threshold
To set the memory usage do as follows, a) Check on the private Memory Usage and enter your desired values b) Click next to proceed c) In the recycling events to log check on the following i) Under Configurable recycling events check on Private memory usage ii) Under runtime recycling events check on On-demand,configuration changes,unhealthy Isapi(Internet Server Application Programming Interface) Note: The purpose of using Isapi extension is to notify the WWW service that the application needs to be recycled
The Recycling in IIS happens as follows: You can specify that IIS recycle an application pool at set intervals (such as every 180 minutes), at a specific time each day, or after the application pool receives a certain number of requests.
You can also configure the element to restart the application pool when the worker process virtual memory and physical memory usage reaches a specific threshold.
You can use the <recycling> element to specify two classes of events to log to the event log when IIS recycles an application pool.
The first class contains recycling events that you can configure, such as those mentioned in the previous paragraph.
The second class includes run-time recycling events, such as on-demand recycling events, recycling events triggered by configuration changes in the application or applications running in the application pool, or recycling caused by an unhealthy Internet Server Application Programming Interface (ISAPI) filter or ISAPI extension.
To Debug the Site: a)Open the Advanced Settings b)Set the Ping Enabled as [ True ] c)Set the Ping Maximum Response Time as [ 900 ] d)Click on Ok, as Sample below
To create a site: a)Add the source to a physical storage b)Add the host name c)finally,click Ok
To Add a website: a)In add web site tab,specify your site name,physical path of your site To configure it in your local systemgo to c:\Windows\System32\drivers\etc\hosts and b)set the ip 127.0.0.1(default) test.yoursitename.com Note: '#' denotes comments remove it to give the ip and domain c)Go to Command prompt and check for the IP is SET properly with 127.0.0.1 i. C:\>Ping test.yoursitename.com
URL Rewrite Need for url re-write: 1)Url-rewriting enables you to forward requests to the new page location without breaking browsers and this happens when you want to ensure that people who have bookmarked old URLs don't break when you move pages around. 2)URL Rewriting can often make it easier to embed common keywords into the URLs of the pages on your sites, which can often increase the chance of someone clicking your link Click on the site you have added in your inetmgr and click URL rewrite click add rule and write the regex to match your url specifics sample url:this url contains the sample regex which works in the combinations of pagenumber,offered or wanted etc
([a-zA-Z]+)[_]([a-zA-Z]+)(([_])(offered|wanted))?(([_])(single|shared))?(([_])(male|female))?([_]([[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]))?$ Rewrite Url: /default.aspx?city={R:1}&statecode={R:2}&pageno={R:13}&rowstofetch=5&fromprice='0'&toprice='0'&orderby=date&requirement={R:5}&gendersrch={R:8}&roomtype={R:11}
|
Did you like this resource? Share it with your friends and show your love!
|
|
|
| Author: Devaraj T N 16 Jun 2012 | Member Level: Gold Points : 0 | Hi Shashwath, the article Configuring the IIS and url-rewrite was excellent and awesome. It is very useful. Keep up your good work. Post many useful articles.
Regards, Devaraj T.N
|
 Follow us on Twitter: https://twitter.com/dotnetspider
|
|