Tip- InProc session state was not working with IIS7.5

In this post I am going to explain about reason for InProcsessionState was not working with IIS 7.5.

Problem:

Yesterday in one of my PC I got updated IIS 7.5 and suddenly after updating the IIS my ASP.NET application session state stopped working. It was a very weird behaviour and after doing some R and D I have found that my worker process per application was more then one.

That was the reason for the  session state was not working as “InProc” session state is using IIS memory to manage sessions.  You can find more information about this in following link.

http://stackoverflow.com/questions/2147578/asp-net-session-state-and-multiple-worker-processes

Resolution:

There are two ways of resolving this problem.

1) You can use other session state mode like State Server or SQL server which supports multiple worker processes.

IIS Error: The process cannot access the file because it is being used by another process.

Recently in our one of the web servers all the sites using port 80 were stopped and when we tried to restart website it was giving error like process cannot access the file because it is being used by another process. After analyzing and diagnosis and searching on internet for the same problem i have found that it was a problem due to port 80 was used by another process. To solve the problem i have following command which will list IPs,PID(Process ID) and port that used by the process. The command is as below.

NETSTAT -ano
After running that command in command in command prompt it will give output like following.

IIS Error, IIS 6.0, IIS 7.0

From that output you can fine which port is used by which PID(Process Id). And then you can find the process from task manager. Process Id column in task manager is not enabled by default so you can do by View Menu->Select Column a following dialog box will appear.

ProcessId

Select PID (Process Identifier) and press OK.Now process Id will appear in task manager and in task manger go to processes tab where you can find out process by checking process id column then select that process right click->click End Process that will kill that process. Now again try to restart the IIS Site it will restart. In my case it was java updater who is using same port 80 and after killing my IIS Sites were ok. Hope this will help you..

Technorati Tags: ,

Shout it
kick it on DotNetKicks.com

Permanent redirection in asp.net 4.0

We all need search engine optimization in our sites. With web 2.0 site its necessary that our site is search engine friendly because if i write this blog but nobody comes to read my blog then what is the worth of it. So for every thing we need to have search engine optimization whether its a blog,site or any thing on web.

For Search Engine Optimization one of the most important thing is the permanent redirection with 301 headers. Now all you say what is 301 headers lets explore this thing in greater details.

301 Header in SEO:

Every dot net programmer does comes along Response.Redirect – It will redirect from one page to another page which causes 302 redirect. For search engine optimization 302 redirection is document is temporary moved from one location to another location so it will keep indexing the other document as well from which we have redirected. In 301 header it will stop the response from older page. So that search engine can index new location permanently.

We can achieve this functionality in asp.net 4.0 directly with permanent redirect method. Like following. It will create 301 headers for search engines/

Response.PermanentRedirect(“http://jalpesh.blogspot.com”);

With the help of this now you can redirect your 302 pages to 301 which will be more search engine friendly then the older one.

IIS 7.0 URL Rewrite Module 2.0 Beta Version is out now.

Url rewriting is an important feature that will enable application to be search engine friendly and make url more readable. IIS 7.0 comes with built in url rewriting module so you don’t need to write more code for url rewriting module. URL Rewriting module will do following for you.

  1. Replace the URLs generated by a web application in the response HTML with a more user friendly and search engine friendly equivalent
  2. Modify the links in the HTML markup generated by a web application behind a reverse proxy.
  3. Fix up the content of any HTTP response by using regular expression pattern matching

You can download IIS 7.0 URL Rewrite Module 2.0 Beta Version from the following.

http://www.iis.net/downloads/default.aspx?tabid=34&i=1904&g=6

It is containing following features.

  1. Rule base url rewriting Engine
  2. Regular Expression Pattern Matching.
  3. Wild card pattern matching.
  4. Global and Distributed rewrite rules.
  5. Access to server variable and http headers.
  6. Various Rule Actions
  7. String manipulation features.
  8. Support for IIS kernel mode and user mode output caching
  9. Failed Request Tracing Support
  10. Rule Templates
  11. UI for testing of regular expression and wildcard patterns
  12. UI for managing rewrite rules and rewrite maps
  13. GUI tool for importing of mod_rewrite rules

For more details about IIS 7.0 Url Rewriting modules visit following links.

http://learn.iis.net/page.aspx/460/using-url-rewrite-module/

http://ruslany.net/2009/07/url-rewrite-module-2-0-for-iis-7-beta/

http://www.15seconds.com/issue/081205.htm

IIS 7.0-Search Engine Optimization toolkit-Microsoft

Before few days Microsoft has launched new Search Engine Optimization Toolkit which will increase search engine optimization for the site hosted by Microsoft IIS Servers. IIS search engine optimization toolkit will help web server administrators, hosting provider to improve their search engine optimization. It will controls the site content more search engine friendly. It has some of the following features.

- Improve search engine optimization by site analysis. Site analysis module contains lots of report which will help to improve your site for search engine optimization.

- It also control how search engine access and display your site pages and content with robot Exclusion modules

-It also has Sitemap and Sitemap Index features which will display user sitemap into simple user interface.

Following are some of link for more details about search engine optimization tool kit for IIS.

http://www.iis.net/extensions/SEOToolkit

http://learn.iis.net/page.aspx/639/using-iis-search-engine-optimization-toolkit/

http://learn.iis.net/page.aspx/640/using-site-analysis-to-crawl-a-web-site/

http://forums.iis.net/1162.aspx

http://learn.iis.net/page.aspx/641/using-site-analysis-reports/

http://blogs.iis.net/bdela/archive/2009/06/05/search-engine-optimization-using-iis-seo-toolkit.aspx

http://weblogs.asp.net/scottgu/archive/2009/06/03/iis-search-engine-optimization-toolkit.aspx

http://blogs.msdn.com/cdndevs/archive/2009/06/03/the-art-of-seo-and-iis.aspx

You can download Search Engine Optimization toolkit from here.

http://www.iis.net/extensions/SEOToolkit

Cheers.. Happy Programming..