Showing posts with label IIS. Show all posts
Showing posts with label IIS. Show all posts

Wednesday, December 21, 2011

Session Timeout in IIS 7 - Worker Process of ApplicationPool

Problem
Recently while testing my application, I was facing problem of Session time out.
By Default Session time is 20 mins and I wanted to extend it
Attempts
if we want to extend it we can set in web.config within System.web tag
<sessionState mode="InProc" timeout="30"></sessionState>
that I already have done.
I set it as 30 mins.
but still my session was getting timed out after 20 min.
So I doubt that it doesn’t apply to my Code so I set It by code also like
System.Web.HttpContext.Current.Session.Timeout = 30;

still no progress

Resolutions

after a long invastigation I came to know Its because Of Default Settings of ApplicationPool for the application in IIS.

There is a setting for Worker process of IIS which will set memory and resource to allot to application application wide.

in my case I was testing my application alone. So application was being idle for more than 20 min to check weather session is alive or not..

To open the settings refer the steps

  1. Type “inetmgr” in run window to open IIS
  2. from left pane “Connections” select your application.
  3. right click on your application and refer the image to open “Advanced Settings” of application(to check which ApplicationPool is referred by application )1
  4. from “Application Settings” window you can see the Name of ApplicationPool. like Asp.net V4.0, DefaultAppPool, Asp.net V4.0 Classic.
  5. now close both opened windows.
  6. from left pan double click on “Application Pools”, a list of created application pools will be displayed. if you want to create new application pool for specific application refer this
  7. Right click on the ApplicationPool that was assigned to your Application and click on "Advanced Settings...."
  8.  in the popup window ... check the Idle time out for ... that cause the timeout while web application is idle.
Here are the steps to set Idle time..

Happy Deploying...


Monday, March 7, 2011

Publish webservice locally without separate hosting

Hi..

here is a way to deploy web service withing project...
Here are the steps for it



in your Project... right click on Project in Solution Explorer.
Click on Add new Item and Select "Web Service"



Name it as per required... and Click on "Add" Button...

now you have your web service ready in local environment...

put you code in Web Service .Cs file

Build the Source and make sure its error free...

now Deployment Part




Right click on "References" in Solution Exporer,

You will find.. three Options like

  •     Add Reference
  •     Add Web Reference
  •     Add Service Reference

Select "Add Web Reference",

you will get a Pop up,

in Below there are three links
Browse to:

    * Web services in this solution
    * Web services on the local machine
    * Browse UDDI Servers on the local network





select "Web services on the local machine "

You will get a list of Web Services existsing on your local machine


select which one you created in current Project

it will be something like

http://localhost/TempProject/WebService1.asmx



now you will get a list of your methods of the web Service..

if till here everything is fine... that means you are going right....


Congratulations

At right side, in Web Reference Name if wish change the name , that name will be the Service name..

now click on "Add Reference"


now in your project you are able to run your service within your IIS.. without any external Deployment

Now whenever you update the Source of Service class... before building the source one update the Service Reference by right click on Service in Web reference Folder in solution explorer..


To change url of your Service...
  1. Remove Url Value from Settings.
  • Steps
    • In Solution Explorer, In Properties Folder, double click on Settings.settings file
    • remove the path.
    • Now in Web.Config file set your Server path Instead of localhost




Now world is yours...

All The Best